Monday, 2 September 2013

SharePoint app give web project (host web) access to documents

SharePoint app give web project (host web) access to documents

I have a provider hosted SharePoint 2013 app. In this app I have a custom
ribbon action that when clicked goes to the host web (Default.aspx). On
this page I want to create a hash for the selected document in SharePoint
with the following code:
Uri FileUri = new Uri(docUrl);
byte[] hashValue;
using (var Client = new WebClient())
{
hashValue =
SHA256Managed.Create().ComputeHash(Client.OpenRead(FileUri));
}
Label2.Text = BitConverter.ToString(hashValue).Replace("-", String.Empty);
docUrl is a string containing the url to the document in SharePoint. In
AppManifest.xml Web, SiteCollection and List all have FullControl.
When I run this I get the error 403 forbidden. Is this because the host
web does not have access to the document? How can it be fixed?

No comments:

Post a Comment