473,385 Members | 1,798 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

access is denied in sharepoint document library event handler word

am opening wordapplication object (Have a reference to Microsfot Interop
assembly) on the server side in sharepoint document library even handler.

I am getting "access is denied" exception. The user is "SPSUser"
Can somebody please help me to overcome this exception.

My code : (getting expception when creating wordapplicaiton)

void IListEventSink.OnEvent(Microsoft.SharePoint.SPList Event listEvent)
{
IntPtr tokenHandler =
System.Security.Principal.WindowsIdentity.GetCurre nt().Token;
WindowsIdentity objWindowsIdentity = new WindowsIdentity(tokenHandler);
CloseHandle(tokenHandler);

WindowsImpersonationContext objWindowsImpersonationContext =
objWindowsIdentity.Impersonate();

try
{
if (listEvent.Type == SPListEventType.Insert)
{
SPWeb site = listEvent.Site.OpenWeb();
SPFile file = site.GetFile(listEvent.UrlAfter);
string fileName = file.Name;
int length = fileName.Length;
string fileExtension = fileName.Substring(length-3);
if(fileExtension.Equals("doc"))
{
wordApplication = new ApplicationClass();
..
..
.. .
..
.. objWordFormExtract.FileName = file.Url;
objWordFormExtract.LoadMyScenarioRecord(ref objScenarioRecord);
if (objScenarioRecord != null)
{
if(objScenarioRecord.StoreRecordInDataBase())
{ errorMessage = "Document is uploaded successfully"; }
}
else
{ errorMessage = objInfoPathFormExtract.ErrorMessage; }
}
}

}

Jul 22 '05 #1
0 1248

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Peter Frost | last post by:
Please help I don't know if this is possible but what I would really like to do is to use On Error Goto to capture the code that is being executed when an error occurs. Any help would be much...
0
by: Michael Meckelein | last post by:
Hi all, some strange things are going on. I have a c# project to automate word written under VS.NET with Office XP PIAs. It is a web application project using ASP.NET, programming language is...
2
by: Eric Li | last post by:
Hi, Group, I am using C# program to launch a Word document in Word 2003. My C# program will be sitting on "top most" while document opened. I would like to hook up an event when Word document...
3
by: buran | last post by:
Dear ASP.NET Programmers, I am trying to save a new created Word document, but getting the following the error. I granted the necessary rights to the ASPNET user, but I'm still getting this...
3
by: Yohancef Chin | last post by:
Hi, Being fairly new to .NET I am looking for a way to call MS Word from an event on a webform, and after the user is finished save that created document to an SQL Server database. Has anyone...
0
by: hareesh | last post by:
am opening wordapplication object (Have a reference to Microsfot Interop assembly) on the server side in sharepoint document library even handler. I am getting "access is denied" exception. The...
6
by: royan | last post by:
Help please! I have the same problem which this post ...
16
by: Neil | last post by:
I posted a few days ago that it seems to me that the Access 2007 rich text feature does not support: a) full text justification; b) programmatic manipulation. I was hoping that someone might...
1
by: jags | last post by:
HI All I was trying to create Document librray programatically in a Sharepoint Site and is not working for me.I was trying to implement this as an Event Handler. The aim of the code is to create...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.