okay I give up
You know it's bad when I do this in my blog. I have tried the newsgroups and googled myself to death and the clock is ticking...
I have been having a problem with getting file objects with SPWeb.GetFile for about a day. No matter what file name/path I pass into GetFile(), I get strange results: SPFile.Exists=false and many operations such as SPFile.Checkout fail. However, SPFile.OpenBinary works just fine. I have had this happen coding this directly into an ASP.NET page as well as when buildling a web service. All of the documentation says "this is the way to do it" but I find nothing that says "but if it doesn't work..." - you know like when you are working with Beta software. I can't imagine I am the first person who has had this problem!
To dig further into the problem, I built a test where I iterate through the webs and folders and then files in the folder, I am then taking a string representing the file (either ServerRelativeURL or some flavor of it) and creating a new file from it. Then if I attempt to SPWeb.GetFile(filepath) using the various paths and you can see that still, I consistently get SPFile.Exists=false even when I know the file is there.
Having iterated to a file in a folder with "For Each fileA As SPFile In folder.Files"
fileA.exist : True fileA.Name: "ABR.XLS"fileA.URL: "Shared Documents/ABR.XLS"fileA.ServerRelativeURL: "/mysite/nn/Shared Documents/ABR.XLS"
create new files with spweb.getfile and test file.exists(ServerRelativeURL) File Exists? ( /mysite/nn/Shared Documents/ABR.XLS ) FalseFile Exists?? ( mysite/nn/Shared Documents/ABR.XLS ) FalseFile Exists? ( nn/Shared Documents/ABR.XLS ) False
So, what gives here?
Remember Me
See my speaking schedule for more events
User Group Leader
Hosted by:
Powered by: newtelligence dasBlog 2.0.7226.0
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.
© Copyright 2008, Julie Lerman
E-mail