Contents
How to reference the site collection url inside the src attribute?
The site collection URL is http://servername/HR. So to reference the script inside my master page I wrote the following: Where I am manually referencing the /hr/ inside the src, so can I make this more dynamic and get the site collection URL dynamically, so if I move the site collection to another URL the script will still get referenced?
In addition, some tokens are usable only in apps. For more information about them, see URL strings and tokens in SharePoint Add-ins. The tokens in the tables of this section can be used in URLs in a wide variety of situations in SharePoint development, such as in custom actions and in links on custom pages.
What does the app part column in SharePoint mean?
The App Part column refers to their use in the query string portion of the value. The URL of the ControlTemplates virtual folder for the current website. The ID of an item in a list or library (an integer). The URL of the item being acted upon.
Where to use tokens in an add in?
Three of the most important places where only a restricted list of tokens can be used are the start page of an add-in, a custom action on the host web, and the Src property of an add-in part. These are called out in separate columns, but this is not an exhaustive list of places where tokens can be used.
No jQuery, no spContext. This can be used on a modern site. Probably needs some tweaking but the idea is to do it using a regex rather than any SharePoint or library provided object. Site URL : _spPageContextInfo.siteAbsoluteUrl e.g. “https://site.sharepoint.com/sites/site1”
How to get top level site collection url?
I got the top level site collection url from my Sharepoint Hosted add-in by using the following code: Of course if you actually want to take any actions on the top level site collection, remember to use the Cross Domain Library, specifically SP.ProxyWebRequestExecutorFactory and SP.AppContextSite so something like:
When to use reference method or collection method?
The Reference method should be used when an entity has a navigation property to another single entity. On the other hand, the Collection method should be used when an entity has a navigation property to a collection of other entities. Applying filters when explicitly loading related entities