.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Post New Web Links

Getting SPRequest object was not disposed before the end of this thread in SP document library event

Posted By:      Posted Date: October 05, 2010    Points: 0   Category :SharePoint
 

I am using a sharepoint event listener attached to a document library to export files when they are added or modified. Here is a partial stack trace from the SP log for the SPRequest object was not disposed:

This SPRequest was allocated at    at Microsoft.SharePoint.Library.SPRequest..ctor()     at Microsoft.SharePoint.SPGlobal.CreateSPRequestAndSetIdentity(SPSite site, String name, Boolean bNotGlobalAdminCode, String strUrl, Boolean bNotAddToContext, Byte[] UserToken, String userName, Boolean bIgnoreTokenTimeout, Boolean bAsAnonymous)     at Microsoft.SharePoint.SPWeb.InitializeSPRequest()     at Microsoft.SharePoint.SPFile.GetFileStream(OpenBinaryFlags openOptions, String etagNotMatch, String& etagNew)     at Microsoft.SharePoint.SPFile.OpenBinary(SPOpenBinaryOptions openOptions)     at Extract.SharePoint.Redaction.IdShieldFileListener.HandleSharePointFileEvent(SPItemEventProperties properties, FileEventType eventType)

Here is basically the code in the HandleSharePointFileEvent:

    public override void ItemUpdated(SPItemEventProperties properties)
    {
        HandleSharePoi


View Complete Post


More Related Resource Links

ItemUpdating event handler causes SPRequest object was not disposed error if properties.ListItem is

  

I have a very simple ItemUpdating event handler that is causing an SPRequest object was not disposed error when it is fired. The event handler is linked to the document library. I have cleaned out all of my code and narrowed it down to this:

    public override void ItemUpdating(SPItemEventProperties properties)
    {
      SPListItem item = properties.ListItem;
      base.ItemUpdating(properties);
    }

When I change the name of a file or folder in my document list the following line is logged in the SP log:

An SPRequest object was not disposed before the end of this thread.  To avoid wasting system resources, dispose of this object or its parent (such as an SPSite or SPWeb) as soon as you are done using it.  This object will now be disposed.  Allocation Id: {D7AA6805-4CA1-458B-9252-E83D32DBD0D3}  To determine where this object was allocated, set Microsoft.SharePoint.Administration.SPWebService.ContentService.CollectSPRequestAllocationCallStacks = true.

 

As an extra note I have actually set the CollectSPRequestAllocationCallStacks to true, this is all the information that it gives me. If I comment out the pr

Intercept Check-In Event of Document Library in SharePoint 2010

  
we need to intercept the default check-in Event of the Document Library. The detailed requirements is as follows.   1. Intercept the check-in Event of Document Library. 2. Instead of the default check-in  page (normally this is the layout's checkin.aspx page), show our custom application page. 3. In the custom application page, allow users to provide some inputs. Validate the input values against values stored in database. 4. Once validated successfully, allow user to check-in the documents. Else, do not allow user to check-in the document.   One more additional requirement is the above things should happen only for our custom content type. In order to achieve the same, we are planning for deploying our custom document content types and perform the above operations on check-in event of the documents.     Another approach of performing the same is , have our own custom ECB Menu. The detailed process is as below.   a. Customize the check in menu (ECB) b. Show the custom form and get the inputs from user and do the validations c. On the OK button click, if validation is success, then update the meta data and check in the document or deny the process. d. But in this approach, we need to check the libraries version settings and that default functionalities should be added automatically to the check in process.   At this point of time, we a

Silverlight client object model : Read a document from a document library

  
How do I read/download a document/file from a SharePoint document library using silverlight client object model? The most closest function that I found was: Microsoft.SharePoint.Client.File.OpenBinaryDirect() but this seems to be throwing an exception "Operation not supported".

Extract document for a SPListItem from a Document Library using the Object Model

  

WSS 3.0

I want to use the object model to extract the document from a Document Library. I am doing a foreach(SPListItem item in docLib).

How can I use SPListItem to get the document for that item?


View previous version of a file in document library using Client Object Model

  

Hi,

 

Using Server-side object model, it is pretty simple to get the previous file versions. Say I wanted to view a file in its initial version, all I’d need to do is :

 

file.Versions[0].File

 

When using Client object model, I couldn’t any analogous method/property which would let me fetch the previous version of file.

Can somebody point me to a sample or the property which would serve my purpose?


how to get complete Document Library url into SPSite object

  

Hi!

some documents are in Document Library of sharepoint 2007.

this url is http://abcd:24931/docu/Forms/AllItems.aspx

my task is

i need to display these documents into datagridview of windows form application.

so, i written SPSite siteurl= new SPSite("http://abcd:24931/docu/Forms/AllItems.aspx");

but here(while debuging...) siteurl object is does not contain above complete url.

just it(siteurl) contain only http://abcd:24931, this is my big problem please provide a soluton....

and i think your understood my task also please provide some idea(coding) about my task.

thanks & regards

jilani

 


how to get complete sharepoint Document Library url into SPSite object

  

Hi!

some documents are in Document Library of sharepoint 2007.

this url is http://abcd:24931/docu/Forms/AllItems.aspx

my task is

i need to display these documents into datagridview of windows form application.

so, i written SPSite siteurl= new SPSite("http://abcd:24931/docu/Forms/AllItems.aspx");

but here(while debuging...) siteurl object is does not contain above complete url.

just it(siteurl) contain only http://abcd:24931, this is my big problem please provide a soluton....

and i think your understood my task also please provide some idea(coding) about my task.

after that some suggestions... i write like below but still i am getting same problem

still i am getting same problem.......

using (SPSite ospSite = new SPSite(http://abcd:24931))   ----->output is not respond

SharePoint Workflow : Failed to Start when a document is added to library from server-side object mo

  

When I add a document using my server-side object model code, I get an exception "The type or namespace name 'Office' does not exist in the namespace 'Microsoft'" in the server logs and in the library I can see the Workflow status as "Failed to Start".

...

myLibrary.Files.Add(...);

myLibrary.Update();

...

Interestingly, when I add a document to the same library from sharepoint site portal, it works just fine, the workflow kicks off with the state : in-progress.

Also, I modified the task form for the Approval workflow template from SharePoint Designer using infopath.(Not sure if that be a problem as adding from portal works fine.)

What am I missing out here??

 Details of the exception:

09/29/2010 18:11:19.15  w3wp.exe (0x2508)                        0x2710 SharePoint Foundation          Workflow Infrastructure        98d8 Unexpected Microsoft.SharePoint.SPException: <Error><CompilerError Line="0" Column="20" Text="The type or namespace name 'Office' does not exist in the namespace 'Microsoft' (a

How to capture event when the document is being openned from Documents Library in Sharepoint 2010?

  

Dear All,

I want to capture the event when user click on document in document library. Please let me know how to capture this event in SharePoint 2010?

Regards,

Sachin Jagtap

 


how to extract the files from the document library using object model

  

Hi,

I need to extract the files from the document library using object model in sharepoint 2007.

Can anyone help me.

Regards,

Jyoshna


Jyoshna

Event handler: properties.AfterProperties on a document library ItemUpdated/ItemAdded event

  

In a ItemUpdated event on a list i normally i use "properties.ListItem" to get data before the changes, and "properties.AfterProperties" to get data after the chages

But when working with document libraries things get a lot complicated. The ItemAdded handler gets called when a file is uploaded, not when the user specifies it's metadata. To handle these metadata i have to use the ItemUpdated handler.
But even there it happens that "properties.ListItem" and "properties.AfterProperties" result both null, so i cannot access any data i need

Is there a way to get a document metadata when it is added to a library?


Event receiver while item adding in a document library in SharePoint2010

  

Hi,

In my SP site i have various document sets.while i adding a new doc in the document set,i have to find the document belongs to which document set.I want to do it an event receiver..Please help me.


Event receiver while item adding in a document library in SharePoint2010

  

Hi,

In my SP site i have various document sets.while i adding a new doc in the document set,i have to find the document belongs to which document set.I want to do it an event receiver..Please help me.


Upload a File to a SharePoint Document Library - Part I

  
The following helper class demonstrates a few techniques that allow documents to be uploaded to a SharePoint document library programmatically without using the API or a custom web service. You don't need to specify a document library name, and it will create any folders specified in the URL as required. File meta data will be updated if any properties are passed.

Debugging Tool: Build a Logging and Event Viewing Library to Help Debug Your .NET Framework-based Ap

  

Building a basic, reusable application framework can make development quicker and easier. This allows you to focus more on the problems at hand and less on the repetitive tasks involved in building any application. In this article, the author presents a framework that provides facilities to access the registry and an extensible framework for logging messages to a console window or the Event Viewer. This reusable framework can be included as a library in your projects, allowing you to display an enhanced, color-coded message log and dynamically change logging levels.

Daryn Kiely

MSDN Magazine May 2003


Visual Basic: Inspect COM Components Using the TypeLib Information Object Library

  

The built-in Object Browser in Visual Basic, like other component browsers such as OLE View and XRay, is one of the more useful tools. But an even better tool would be customizable. You can build your own type library browser using the TypeLib Information Object Library (TLI), a set of COM objects designed to allow programmers to browse type libraries programmatically. This article explains type libraries and the TLI object model, and shows how to use the collections to get information about objects, leading to the creation of a custom type library explorer.

Jason Fisher

MSDN Magazine December 2000


IE closing when user try to access the document library

  
<!-- /* Style Definitions */ p.MsoNormal, li.MsoNormal, div.MsoNormal {mso-style-parent:""; margin:0in; margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:12.0pt; font-family:"Times New Roman"; mso-fareast-font-family:"Times New Roman";} @page Section1 {size:8.5in 11.0in; margin:1.0in 1.25in 1.0in 1.25in; mso-header-margin:.5in; mso-footer-margin:.5in; mso-paper-source:0;} div.Section1 {page:Section1;} --> IE closing (crashing) when user try to access the document library in share point site.  here we are using WSS2.0.  this problem for not accursed all the users , this problem happening on some users. 

Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend