Pages

Showing posts with label SharePoint web services. Show all posts
Showing posts with label SharePoint web services. Show all posts

Sunday, July 26, 2009

Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

I have written web service program to fetch all list names from web application, in that case I was getting access denied error while retrieving Title of SPWEB object.

Error:


at Microsoft.SharePoint.SPGlobal.HandleUnauthorizedAccessException(UnauthorizedAccessException ex) at 'SPWEB.Title' threw an exception of type 'System.UnauthorizedAccessException'

I have found that my current user don’t have access rights to access some of the sites, after giving required access rights my web service program gave me correct output without any errors.

:)

Wednesday, June 10, 2009

SharePoint web services – permission for GetWebCollection method

For one of my requirement I took the advantage of SharePoint web services, actually I needs to make a windows application which will get the information for all document libraries and list down all the documents inside each document library from SharePoint site.

 

So I have used WEBS and LISTS web service to get my required results, while working with WEBS web service, I used web method GetWebCollection() from WEBS web service to take all the web site name underneath one SharePoint web site, the windows application runs well for development sites but for production sites it’s giving me unauthorized access error while accessing GetWebCollection() method, because I don’t have sufficient rights into product site, I was thinking that for executing GetWebCollection() method, I need service account or extra full control rights, but after finding from the internet, I had conclude that I just need “contributor” rights into all sites and sub-sites while working with GetWebCollection() method.

 User needs “browse directories” permission.

 Reference Link:

 http://www.novolocus.com/2008/07/03/browse-directories-and-webs-getwebcollection-strangeness/

From my point of view, we can do all things with SharePoint web services which we can achieve from SharePoint object model, just we need to know which web services and web method to call.

Happy coding !!

Anonymous access into SharePoint web services

Till now I didn’t find how to anonymous access web services, we can impersonate our SharePoint object model code by writing block of code under SPSecurity.Runwithelevatedprivileges method, I am looking for something like this for my web services code, I tried to find solution from internet, but I didn’t get success.

 

I can run or authenticate my web service code by passing current user credentials or any custom credentials (user name, password, domain name), but I am looking something different in authentication mode, please reply to me if any of you find some solutions or any alternatives for my challenge problem and I’ll also do same thing.

 

Thank you very much!