473,659 Members | 3,494 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(Microso ft.SharePoint.S PListEvent listEvent)
{
IntPtr tokenHandler =
System.Security .Principal.Wind owsIdentity.Get Current().Token ;
WindowsIdentity objWindowsIdent ity = new WindowsIdentity (tokenHandler);
CloseHandle(tok enHandler);

WindowsImperson ationContext objWindowsImper sonationContext =
objWindowsIdent ity.Impersonate ();

try
{
if (listEvent.Type == SPListEventType .Insert)
{
SPWeb site = listEvent.Site. OpenWeb();
SPFile file = site.GetFile(li stEvent.UrlAfte r);
string fileName = file.Name;
int length = fileName.Length ;
string fileExtension = fileName.Substr ing(length-3);
if(fileExtensio n.Equals("doc") )
{
wordApplication = new ApplicationClas s();
..
..
.. .
..
.. objWordFormExtr act.FileName = file.Url;
objWordFormExtr act.LoadMyScena rioRecord(ref objScenarioReco rd);
if (objScenarioRec ord != null)
{
if(objScenarioR ecord.StoreReco rdInDataBase())
{ errorMessage = "Document is uploaded successfully"; }
}
else
{ errorMessage = objInfoPathForm Extract.ErrorMe ssage; }
}
}

}

Jul 22 '05 #1
0 1261

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

Similar topics

6
4739
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 appreciated. Thanks in advance
0
272
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 c#. Office Version 2002 (Microsoft Word 10.0 Object Library version 8.2). All works fine.
2
7801
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 has been closed (not Word application), my program will be closed automatically too. I can't find the "Close" event in ActiveDocument. There are events for "New" and "Open". How do I create event handler for document closed?
3
2537
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 error. Thanks in advance, Buran Dim objWordApp As New Microsoft.Office.Interop.Word.Application()
3
6117
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 done this? Does it seem possible? I followed the instructions from a sample on the Microsoft knowledge base but it only seems to work when creating a VB.NET Windows .EXE, not an VB.NET ASP app.
0
964
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 user is "SPSUser" Can somebody please help me to overcome this exception. My code : (getting expception when creating wordapplicaiton) void IListEventSink.OnEvent(Microsoft.SharePoint.SPListEvent listEvent) {
6
5557
by: royan | last post by:
Help please! I have the same problem which this post http://groups.google.com/group/microsoft.public.vsnet.vstools.office/browse_thread/thread/91275741fa1e100f/164638c6d6ba3872?lnk=gst&q=System.UnauthorizedAccessException%3A+Access+is+denied.&rnum=1&hl=en#164638c6d6ba3872 When I deploy our ASP.NET Application web form to Windows server 2003 I got access deny error. We are using the Microsoft.Office.Interop.Word COM DLL. We need to read a...
16
11062
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 know one way or the other whether that was true or not, or could point me to an article or help text that would. What I have seen so far online and in Access 2007 help seems to confirm the above. But that (or at least (b)) seems incredible that it...
1
5534
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 a Folder with the same name as in folder which has been added.For eg if i am creating a folder titled A in a Doc library called A1 then I shud have a folder names A in a document library called as 'Request for Proposals' (this is predifened) below...
0
8428
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8337
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8748
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8531
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7359
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6181
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5650
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4175
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
1978
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.