Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I am using the following code to create a file and then check it in:

//Some other code above.  The following line works fine.
createdItem = ceoList.UpdateListItems("Pages", newItem);
//But this line throws a file not found error
ceoList.CheckInFile("http://myServer:88/" + newUrl, "Automated version created by the Publish Friday Memo on the internal sharepoint site.", "2"); 

If I debug this and place the line: "http://myServer:88/" + newUrl in my immediate window I get the url I would expect. If I navigate to that URL i see the page I want. But when I run the CheckInFile line I get a SOAP file not found exception. Any idea why this would happen?

Below is the stack trace:

SOAP exception: System.IO.FileNotFoundException: The system cannot find the file specified. (Exception from HRESULT: 0x80070002) at Microsoft.SharePoint.Library.SPRequestInternalClass.GetMetadataForUrl(String bstrUrl, Int32 METADATAFLAGS, Guid& pgListId, Int32& plItemId, Int32& plType, Object& pvarFileOrFolder) at Microsoft.SharePoint.Library.SPRequest.GetMetadataForUrl(String bstrUrl, Int32 METADATAFLAGS, Guid& pgListId, Int32& plItemId, Int32& plType, Object& pvarFileOrFolder) at Microsoft.SharePoint.SPWeb.GetListItem(String strUrl, Boolean bFields, String[] fields) at Microsoft.SharePoint.SoapServer.ListDataImpl.CheckInFile(String pageUrl, String comment, String CheckinType) at Microsoft.SharePoint.SoapServer.ListDataValidatorImpl.CheckInFile(String pageUrl, String comment, String CheckinType) at Microsoft.SharePoint.SoapServer.Lists.CheckInFile(String pageUrl, String comment, String CheckinType)

share|improve this question
add comment

2 Answers

up vote 3 down vote accepted

I ended up getting around this by adding the following line after I declared the ceoList instance:

ceoList.UnsafeAuthenticatedConnectionSharing = true;

Apparently the connection is closed after a call to a web service unless you add this line.

Reference: http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.unsafeauthenticatedconnectionsharing.aspx

I think you can also reauthenticate before every call instead of adding this line. Hope this helps someone!

share|improve this answer
add comment

When using a client such as a ListsSoapClient, you can check the State property and reopen the connection like this:

if (listsClient.State != CommunicationState.Opened)
    listsClient.Open();
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.