2

I built a PHA using MVC a little while ago. I'm receiving "Access denied. You do not have permission to perform this action or access this resource." error when trying to update or even access simple things (e.g., current user's name). I added the username the app is running under to a group with Full Control on the site and even as an SCA. When I installed the app, I selected "full trust" for the app, and I have clicked that button a few times since then.

sample:

                    var spContext = SharePointContextProvider.Current.GetSharePointContext(HttpContext);

                    using (var clientContext = spContext.CreateUserClientContextForSPHost())
                    {
                        if (clientContext != null)
                        {
                                clientContext.Load(clientContext.Web);
                                clientContext.ExecuteQuery(); //breaks here
                                clientContext.Load(clientContext.Web.CurrentUser);
                                clientContext.ExecuteQuery();
                        }
                   }

Note: This app was previously working for me while debugging for the past 3-4 weeks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.