问题
Can someone explain what's the difference between the usage of SPAppWebUrl and SPHostUrl - from examples I guess that these URLs influence the context which is accessed.
Is this correct? And if yes - what are the differences in general (I already saw that Web.Lists gets back another collection of lists)? And are there more context URLs which I can use in my provider hosted app?
Could this be the issue of my other problem? See Sharepoint Online: Create & use List in Provider Hosted App (C#)
回答1:
SPHostUrl is the url of the host url as the name already tells. That means it is the url of the sharepoint system.
SPAppWebUrl is the url of the app web. For example it could is the provider hosted apps address.
I think these are no other context urls.
回答2:
SPHostUrl provide the URL for the host and SPAppWebUrl the app web.
SPAppWebUrl is always available to the remote web and can be used to create a client context for scenarios in which the SharePoint app is using the “internal” security principal.
SPHostUrl is the base URL of the host web. With this Url you can retrieve host web information like the following:
// retrieve host web information
string hostWebUrl = Request.QueryString[“SPHostUrl”];
Uri hostWebUri = new Uri(hostWebUrl);
string hostWebAuthority = hostWebUri.Authority;
来源:https://stackoverflow.com/questions/34853193/sharepoint-online-difference-between-spappweburl-sphosturl