0

I have a block of code wrapped in an if:

mySite.AllowUnsafeUpdates();
SPFile mySPFile = web.GetFile(someURL);

if (mySPFile.Exists) /*returns true, enters code block*/ {
    //... make some updates
    mySPFile.Update(); //FAILS here, HRESULT 0x80070003 - File not found
}

If the file existed in the condition for the if, why can't it be found when I try to save the changes I made to its properties?

  • We have a workaround: instead of going to the file (which is within a subsite) directly by URL, we are opening the containing subsite first and then accessing it by GUID. – sq33G Jun 3 '12 at 11:31
1

I would recomand you read this article from Waldek concerning problems revolving with web.GetFile() available at http://blog.mastykarz.nl/inconvenient-spwebgetfilestring/ and confront with your code, particularly when you passing a certain URL to the method.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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