SPSite mysite = new SPSite("http://servername:portnumber");
SPWeb myWeb = mysite.OpenWeb();
myWeb.AllowUnsafeUpdates = true;
SPList Document = myWeb.Lists["Shared Documents"];
SPQuery query = new SPQuery();
query.Query ="<Where><IsNotNull><FieldRef Name='CheckoutUser' /></IsNotNull></Where>";
SPListItemCollection checkedOutItems= Document.GetItems(query);
Response.Write(checkedOutItems.Count);
I got the following error:
System.Runtime.InteropServices.COMException: Cannot complete this action
Resolution:
We need add the tag "<identity impersonate='true'/>
This is because the ASP.NET doesnt allows you to read the outside documents i.e the documents(folders) are not in ASP.NET Application.So we need to keep impersonate = true in web.config file.
Hopes this helps you....
1 comment:
i am also getting the error
System.Runtime.InteropServices.COMException: Cannot complete this action
i have added the tag "" tag in the web.config but it did not solved the problem either.Can you guess why it could be
Post a Comment