Skip to content

Commit a462308

Browse files
authored
Final edit pass for Develop sp-add-ins (SharePoint#1186)
* Final edit * Final edit * Removed captions and added breaks * Final edit * Final edit * Final edit * Tweaks * Fixed link
1 parent 77a92f4 commit a462308

13 files changed

+933
-1578
lines changed

docs/sp-add-ins/authorization-code-oauth-flow-for-sharepoint-add-ins.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,5 +432,9 @@ namespace DynamicAppPermissionRequest
432432

433433

434434
- [Get started creating provider-hosted SharePoint Add-ins](get-started-creating-provider-hosted-sharepoint-add-ins.md)
435+
436+
- [Creating SharePoint Add-ins that use low-trust authorization](creating-sharepoint-add-ins-that-use-low-trust-authorization.md)
437+
438+
435439

436440

docs/sp-add-ins/context-token-oauth-flow-for-sharepoint-add-ins.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Complete basic operations using SharePoint REST endpoints
2+
title: Context Token OAuth flow for SharePoint Add-ins
33
ms.date: 09/25/2017
44
ms.prod: sharepoint
55
---
@@ -126,6 +126,8 @@ These are the steps that correspond to the numbers in the figure:
126126

127127

128128
- [Get started creating SharePoint-hosted SharePoint Add-ins](get-started-creating-sharepoint-hosted-sharepoint-add-ins.md)
129+
130+
- [Creating SharePoint Add-ins that use low-trust authorization](creating-sharepoint-add-ins-that-use-low-trust-authorization.md)
129131

130132

131133

docs/sp-add-ins/convert-an-autohosted-sharepoint-add-in-to-a-provider-hosted-add-in.md

Lines changed: 141 additions & 321 deletions
Large diffs are not rendered by default.

docs/sp-add-ins/create-a-sharepoint-add-in-that-contains-a-document-template-and-a-task-pane-add.md

Lines changed: 133 additions & 250 deletions
Large diffs are not rendered by default.

docs/sp-add-ins/create-provider-hosted-sharepoint-add-ins-to-access-sap-data-by-using-the-sap-ga.md

Lines changed: 405 additions & 510 deletions
Large diffs are not rendered by default.

docs/sp-add-ins/create-sharepoint-add-ins-that-can-be-used-by-anonymous-users.md

Lines changed: 76 additions & 158 deletions
Large diffs are not rendered by default.

docs/sp-add-ins/creating-sharepoint-add-ins-that-use-high-trust-authorization.md

Lines changed: 43 additions & 106 deletions
Large diffs are not rendered by default.

docs/sp-add-ins/creating-sharepoint-add-ins-that-use-low-trust-authorization.md

Lines changed: 46 additions & 116 deletions
Large diffs are not rendered by default.
Lines changed: 27 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,98 +1,72 @@
11
---
22
title: Creating SharePoint Add-ins that use the cross-___domain library
3-
ms.date: 09/25/2017
3+
description: Intended for scenarios where the add-in has cloud-hosted components, but the customer's corporate firewall makes it difficult to use the low-trust system. The user's browser blocks scripts from other domains, but the JavaScript library encapsulates a secure system for working around this restriction.
4+
ms.date: 12/27/2017
45
ms.prod: sharepoint
56
---
67

78

8-
# Creating SharePoint Add-ins that use the cross-___domain library
9-
Learn about the SharePoint cross-___domain JavaScript library.
10-
9+
# Creating SharePoint Add-ins that use the cross-___domain library
1110

12-
11+
There are some scenarios in which neither the low-trust nor the high-trust authorization systems can be used by a SharePoint Add-in, or they are not a good choice as the only means for the add-in to gain authorization to SharePoint resources.
1312

14-
There are some scenarios in which neither the low-trust nor the high-trust authorization systems can be used by a SharePoint Add-in, or they are not a good choice as the only means for the add-in to gain authorization to SharePoint resources. Examples:
15-
13+
Examples:
1614

17-
- The remote components of the SharePoint Add-in are not on-premise, but a corporate firewall blocks server-to-server communication between SharePoint and ACS, thereby preventing the use of the low-trust system.
15+
- The remote components of the SharePoint Add-in are not on-premises, but a corporate firewall blocks server-to-server communication between SharePoint and ACS, thereby preventing the use of the low-trust system.
1816

19-
2017
- The SharePoint Add-in is designed as a single-page web application that relies on client-side JavaScript for data operations with SharePoint.
2118

22-
2319
- The SharePoint Add-in relies mainly on server-to-server calls to access SharePoint data (and is authorized by either the low-trust or high-trust systems), but it needs to be supplemented with some JavaScript calls. For example, a graphics-heavy page can use JavaScript to make minor updates to displayed data without having to reload the entire page.
2420

25-
26-
However, [for security](http://msdn.microsoft.com/en-us/library%28d=robot%29/cc709423(d=robot,l=en-us,v=vs.85).aspx), browsers do not allow JavaScript that is hosted on one ___domain to access resources on another ___domain, so a special technique is required to allow the remote JavaScript to access SharePoint resources. The SharePoint cross-___domain JavaScript library makes it easy for your remote web application to use the technique.
21+
However, [for security](https://msdn.microsoft.com/en-us/library(d=robot)/cc709423(d=robot,l=en-us,v=vs.85).aspx), browsers do not allow JavaScript that is hosted on one ___domain to access resources on another ___domain, so a special technique is required to allow the remote JavaScript to access SharePoint resources. The SharePoint cross-___domain JavaScript library makes it easy for your remote web application to use the technique.
2722

2823
> [!NOTE]
29-
> The cross-___domain library is also used to allow access to data in the reverse direction; that is, to allow JavaScript on a SharePoint page to access data in a remote ___domain. See [Access remote data from a SharePoint page](#ReverseDirection) for more information.
30-
31-
24+
> The cross-___domain library is also used to allow access to data in the reverse direction; that is, to allow JavaScript on a SharePoint page to access data in a remote ___domain. For more information, see [Access remote data from a SharePoint page](#ReverseDirection).
3225
3326
## Understand the architecture of the cross-___domain library
3427

35-
The SharePoint cross-___domain library is contained in the file SP.RequestExecutor.js which is located in the /_layouts/15/ virtual folder of every SharePoint website. The scripts in this file encapsulate a secure well-known technique for overcoming the browser's restriction on cross-___domain scripting: An iFrame can communicate with its parent page by means of the `window.postMessage()` function, even if the page in the iFrame is in a different ___domain. So data requests and responses are passed over the ___domain boundary by using calls to `postMessage()`.
28+
The SharePoint cross-___domain library is contained in the file SP.RequestExecutor.js, which is located in the /_layouts/15/ virtual folder of every SharePoint website. The scripts in this file encapsulate a secure well-known technique for overcoming the browser's restriction on cross-___domain scripting: an iFrame can communicate with its parent page by means of the `window.postMessage()` function, even if the page in the iFrame is in a different ___domain. So data requests and responses are passed over the ___domain boundary by using calls to `postMessage()`.
3629

37-
38-
39-
40-
**Caution** The `postMessage()` function works only on browsers that support HTML 5, so SharePoint Add-ins that use the cross-___domain library will not work on older browsers.
30+
> [!WARNING]
31+
> The `postMessage()` function works only on browsers that support HTML 5, so SharePoint Add-ins that use the cross-___domain library will not work on older browsers.
4132
33+
For SharePoint, the cross-___domain library is loaded on a page of the remote web application where it creates a hidden iFrame that hosts a special proxy page from the SharePoint ___domain. The proxy page already exists on every SharePoint website.
4234

43-
For SharePoint, the cross-___domain library is loaded on a page of the remote web application where it creates a hidden iFrame that hosts a special proxy page from the SharePoint ___domain. The proxy page already exists on every SharePoint website. The library is used to create a JavaScript Object Notation (JSON) object which contains all the information needed to make a CRUD call to the REST APIs of SharePoint. The JSON object is passed to the proxy page by using `postMessage()`. On the proxy page, where the library is also loaded, the JSON object is parsed and reconstructed as a REST call to SharePoint. Since the proxy page is in the SharePoint ___domain, the browser allows the call.
44-
35+
The library is used to create a JavaScript Object Notation (JSON) object which contains all the information needed to make a CRUD call to the REST APIs of SharePoint. The JSON object is passed to the proxy page by using `postMessage()`. On the proxy page, where the library is also loaded, the JSON object is parsed and reconstructed as a REST call to SharePoint. Because the proxy page is in the SharePoint ___domain, the browser allows the call.
4536

46-
4737
Of course, the remote components of the SharePoint Add-in still have to have authorized access to the SharePoint resources. There are two ways to do this:
48-
4938

50-
51-
52-
- Set the add-in principal type to **RemoteWebApplication** (the default for provider-hosted apps) in the add-in manifest. When the add-in is registered with ACS, the registration includes the ___domain of the remote web application. SharePoint trusts domains that are registered with ACS, even though it is not, in this scenario, using any of the token passing flows that are part of the server-side low-trust system. For detailed information about registering add-ins, see [Register SharePoint Add-ins 2013](register-sharepoint-add-ins.md).
39+
- Set the add-in principal type to **RemoteWebApplication** (the default for provider-hosted apps) in the add-in manifest. When the add-in is registered with ACS, the registration includes the ___domain of the remote web application. SharePoint trusts domains that are registered with ACS, even though it is not, in this scenario, using any of the token passing flows that are part of the server-side low-trust system. For detailed information about registering add-ins, see [Register SharePoint Add-ins](register-sharepoint-add-ins.md).
5340

54-
55-
- In a SharePoint-hosted add-in, you can leave the add-in principal type set to its default, which is **Internal**. Then set the **AllowedRemoteHostUrl** attribute of the **Internal** element to the URL of the remote web application, as in the following example.
41+
- In a SharePoint-hosted add-in, you can leave the add-in principal type set to its default, which is **Internal**. You can then set the **AllowedRemoteHostUrl** attribute of the **Internal** element to the URL of the remote web application, as in the following example.
5642

57-
```
43+
```XML
5844
<AppPrincipal>
59-
<Internal AllowedRemoteHostUrl="https://example.com/Home.html" />
60-
</AppPrincipal>
45+
<Internal AllowedRemoteHostUrl="https://example.com/Home.html" />
46+
</AppPrincipal>
6147
```
6248

6349
> [!NOTE]
64-
> If you use the second option (an **Internal** add-in principal), then you can use only JavaScript and the cross-___domain library to access SharePoint. The SharePoint client object model is blocked for **Internal**SharePoint Add-ins, so you cannot have a dual authorization system that uses both the cross-___domain library and either the low-trust or high-trust systems.
65-
50+
> If you use the second option (an **Internal** add-in principal), you can use only JavaScript and the cross-___domain library to access SharePoint. The SharePoint client object model is blocked for **Internal** SharePoint Add-ins, so you cannot have a dual authorization system that uses both the cross-___domain library and either the low-trust or high-trust systems.
6651
67-
For details on how to use the library, see [Access SharePoint data from add-ins using the cross-___domain library](access-sharepoint-data-from-add-ins-using-the-cross-___domain-library.md).
52+
For details on how to use the library, see [Access SharePoint data from add-ins using the cross-___domain library](access-sharepoint-data-from-add-ins-using-the-cross-___domain-library.md).
6853

6954

70-
55+
<a name="ReverseDirection"> </a>
7156

7257
## Access remote data from a SharePoint page
73-
<a name="ReverseDirection"> </a>
74-
75-
The SharePoint cross-___domain library can also be used in the reverse direction; that is, JavaScript on a SharePoint page can use the library to get data from the remote components of the add-in. To do this, you reverse the cross-___domain architecture: you create a proxy page in the remote web application. The library is called from a SharePoint page where it creates an iFrame to host the proxy page. For details on how to use the library in this way, see [Create a custom proxy page for the cross-___domain library in SharePoint](create-a-custom-proxy-page-for-the-cross-___domain-library-in-sharepoint.md).
76-
7758

78-
79-
80-
## In this section
81-
<a name="ReverseDirection"> </a>
59+
The SharePoint cross-___domain library can also be used in the reverse direction; that is, JavaScript on a SharePoint page can use the library to get data from the remote components of the add-in. To do this, you reverse the cross-___domain architecture: you create a proxy page in the remote web application. The library is called from a SharePoint page where it creates an iFrame to host the proxy page.
8260

83-
84-
- [Access SharePoint data from add-ins using the cross-___domain library](access-sharepoint-data-from-add-ins-using-the-cross-___domain-library.md)
85-
86-
87-
- [Work with the cross-___domain library across different Internet Explorer security zones in SharePoint Add-ins](work-with-the-cross-___domain-library-across-different-internet-explorer-security-z.md)
88-
61+
For details about how to use the library in this way, see [Create a custom proxy page for the cross-___domain library in SharePoint](create-a-custom-proxy-page-for-the-cross-___domain-library-in-sharepoint.md).
8962

9063

9164
## See also
92-
<a name="ReverseDirection"> </a>
93-
9465

95-
- [Solving cross-___domain problems in SharePoint Add-ins](http://blogs.msdn.com/b/officeapps/archive/2012/11/29/solving-cross-___domain-problems-in-apps-for-sharepoint.aspx)
66+
- [Access SharePoint data from add-ins using the cross-___domain library](access-sharepoint-data-from-add-ins-using-the-cross-___domain-library.md)
67+
- [Work with the cross-___domain library across different Internet Explorer security zones in SharePoint Add-ins](work-with-the-cross-___domain-library-across-different-internet-explorer-security-z.md)
68+
- [Solving cross-___domain problems in SharePoint Add-ins (blog post)](https://blogs.msdn.microsoft.com/officeapps/2012/11/29/solving-cross-___domain-problems-in-apps-for-sharepoint/)
69+
- [Authorization and authentication of SharePoint Add-ins](authorization-and-authentication-of-sharepoint-add-ins.md)
9670

9771

9872

docs/sp-add-ins/handle-security-tokens-in-provider-hosted-low-trust-sharepoint-add-ins.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,8 @@ The free [Fiddler tool](http://www.telerik.com/fiddler) can be used to capture
504504

505505

506506
- For a code sample that uses REST calls from a PHP add-in: [SharePoint: Perform operations on SharePoint Document Library from PHP site](https://code.msdn.microsoft.com/SharePoint-Perform-8a78b8ef)
507+
508+
- [Creating SharePoint Add-ins that use low-trust authorization](creating-sharepoint-add-ins-that-use-low-trust-authorization.md)
507509

508510

509511

0 commit comments

Comments
 (0)