Question

I created Web Part with Custom Properties

My issue is that only the admin profile can edit the properties

Users with contributerole can't edit the webpart. He gets this error :

Sorry this site is not shared with you

This is how my custom tool part is created : https://msdn.microsoft.com/en-us/library/dd584178(v=office.11).aspx

Any idea if there is any authorisation for custom tool parts?

Was it helpful?

Solution

The problem was :

SPContext.Current.Site.AllWebs

to get all webs in current site, this recommende the admin role , had to change it to :

web.GetSubwebsForCurrentUser();

the reference : https://msdn.microsoft.com/EN-US/library/office/microsoft.sharepoint.client.web.getsubwebsforcurrentuser.aspx

and the code become like this :

 using (SPSite site = new SPSite(SPContext.Current.Site.Url))
            {


                using (SPWeb web = site.OpenWeb())
                {
                    SPWebCollection webCollection = web.GetSubwebsForCurrentUser();

                    foreach (SPWeb subweb in webCollection)
                    {  
                            SiteNameImageGallery.Items.Add(subweb.Name);
                    }.....
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top