Issue in using web.GetFileOrFolderObject

Hi,

I have a requirement like there is a button on my webpart "Download", I am storing the document url in one list and accessing that url using

web.GetFileOrFolderObject (documenturl)

In client machine I am getting error when I clicked on this button, I checked the document in document library , it is stored as draft version and because of this my complete web part (which includes grid view also) is broken, even though I am using try catch block...how to avoid this situation.GetFile Object is also not working.

One more thing I have observed that the document library where I am accessing the document id version enabled and in Draft mode

Thanks In Advance.....


May 16th, 2015 11:20am

Hello,

It seems that "Require documents to be checked out before they can be edited " setting is enabled for this library and when you upload any document then initially it is draft/checkout mode. I think error is coming because draft files are only visible to authorize users.

Two things need to check:

1. What happen when you checkin the file and run your webpart?

2. If file in draft mode then try to execute your code with higher privileged account which has at least approver right on that library. (try to login with full control account and run your webpart)

Let us know your result

Free Windows Admin Tool Kit Click here and download it now
May 18th, 2015 1:36am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics