Sharepoint Online: Difference between SPAppWebUrl & SPHostUrl

爱⌒轻易说出口 提交于 2019-12-10 11:45:56

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!