"Cannot complete this action" in SPRequestInternalClass.RenderListProperty for document library templates

"Cannot complete this action" in SPRequestInternalClass.RenderListProperty for document library templates

February 20th, 2006 // 5:43 pm @

If you come across an error saying “Cannot complete this action” when trying to modify the document library template pages, with an exception trace showing a crash in SPRequestInternalClass.RenderListProperty, you have hit an issue similar to KB 901259.


I had a webpart which built a navigation tree by querying the subsites and document library subfolders under any site. As soon as I put them on the allitems.aspx page under the c:Program FilesCommon FilesMicrosoft Sharedweb server extensions60TEMPLATE1033STSLISTSDOCLIB folder, I started receiving this error. Strangely when I placed the control at the end of the existing page it worked.


My code was as follows :



SPWeb currentWeb = SPControl.GetContextWeb(Context);


string currentSiteUrl = currentWeb.Url;


SPListCollection splstcol;
currentWeb.Lists.IncludeRootFolder = true;
splstcol = currentWeb.Lists;


If I placed my control before any calls to the or any such control which queried list properties, I was getting the above error.


The reason from what I figured out, is that SharePoint gives the reference to the current object when obtained from the GetContextWeb method. When I tried to set the IncludeRootFolder = true, I ended up modifying the properties of the current web object, and this somehow caused an internal crash whenever sharepoint tried to query list properties via calls to controls such as on the page. So when I placed my control at the end of the page, after all such controls it worked, but when any such ListProperty was queried after my control ran, it crashed.


The solution to overcome this problem was very simple. Do not get the existing object references, but create your own instance of the objects. So after modifying the code as follows, everything started working as it should be.



SPSite mySite = new SPSite(SPControl.GetContextWeb(Context).Url);
SPWeb currentWeb = mySite.OpenWeb();


string currentSiteUrl = currentWeb.Url;
SPListCollection splstcol;
currentWeb.Lists.IncludeRootFolder = true;
splstcol = currentWeb.Lists;


I haven’t checked to see if this happens on other such template pages, but in case it does, I guess the solution should be quite straightforward.


Category : SharePoint

6 Comments → “"Cannot complete this action" in SPRequestInternalClass.RenderListProperty for document library templates”


  1. Dan Winter [MSFT]

    5 years ago

    Well done, and a good read…


  2. Demo

    5 years ago

    Very informative post… Thanks


  3. http://

    5 years ago

    Stay alert for some memory leak in production environment if you don’t call Dispose at SPWeb instance.


  4. http://

    5 years ago

    This is more then well done, for 3 weeks I was trying to solve the same problem and could not find an answer.
    Thanks a million.

    Now before call dispose, please read this http://support.microsoft.com/default.aspx?scid=kb;EN-US;901259


  5. Ralph Krausse

    4 years ago

    I got this error because I was using impersonation within my code WindowsIdentity(). After looking at my code, I actually didn’t need this and it resolved that error message. I got the error message when I called the URL property of SPWeb AFTER I did the impersonation. Calling it before worked fine…


  6. http://

    3 years ago

    very good


Leave a Reply

Latest Posts

Testimonials

"Amar clearly has a thorough knowledge of Sharepoint, this knowledge, coupled with his professionalism and dedication made him a tremendous asset to the project. He was the key contributor to the later stages of the project delivery effort (the really difficult bit, long hours and hard work that puts huge demands on people), and I can state categorically that without his focussed dedication and hard work we would not have been able to meet the timescales imposed upon the project."

Tim Ellis , Sharepoint Project Manager , Royal Bank of Scotland

Subscribe Now