1

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?

2

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);
                    }.....

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.