You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/general-development/how-to-avoid-getting-throttled-or-blocked-in-sharepoint-online.md
+65-13Lines changed: 65 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -144,25 +144,77 @@ Setting and publishing exact throttling limits sounds very straightforward, but
144
144
- Reduce the frequency of calls
145
145
146
146
147
-
-Use incremental back off to reduce the number and frequency of calls until no more throttling occurs
147
+
-Decorate your traffic so we know who you are (see section on traffic decoration best practice more on that below)
148
148
149
-
149
+
150
+
If you do run into throttling, we recommend incremental back off to reduce the number and frequency of calls until no more throttling occurs.
151
+
150
152
Incremental back off uses progressively longer waits between retries before trying again to run the code that was throttled. You can use the GitHub code samples, later in this article, written as extension methods, to add incremental back off to your code.
151
-
152
-
153
153
154
154
Backing off is the fastest way to handle being throttled because SharePoint Online continues to log resource usage while a user is being throttled. In other words, aggressive retries work against you because even though the calls fail, they still accrue against your usage limits. The faster you back off, the faster you'll stop exceeding usage limits.
155
-
156
-
157
-
155
+
158
156
For information about ways to monitor your SharePoint Online activity, see [Diagnosing performance issues with SharePoint Online](https://support.office.com/en-us/article/3c364f9e-b9f6-4da4-a792-c8e8c8cd2e86).
159
-
160
-
161
-
157
+
162
158
For a broader discussion of throttling on the Microsoft Cloud, see [Throttling Pattern](http://msdn.microsoft.com/library/4baf5af2-32fc-47ab-8569-3e5c59a5ebd5.aspx).
163
-
164
-
165
-
159
+
160
+
## How to decorate your http traffic to avoid throttling?
161
+
162
+
To ensure and maintain high-availability, some traffic may be throttled. Throttling happens when system health is at stake and one of the criteria used for throttling is traffic decoration, which impacts directly on the prioritization of the traffic. Well decorated traffic will be prioritized over traffic which is not properly decorated.
163
+
164
+
What is definition of undecorated traffic?
165
+
166
+
- Traffic is undecorated if there is no AppID/AppTitle or User Agent string in CSOM or REST API call to SharePoint Online.
167
+
168
+
What are the recommendation?
169
+
170
+
- If you have created an application, recommendation is to register and use AppID and AppTitle – This will ensure the best overall experience and best path for any future issue resolution. Include also the User Agent string information as defined in following step.
171
+
172
+
- Make sure to include User Agent string in your API call to SharePoint with following naming convention
173
+
174
+
| Type | User Agent | Description |
175
+
|---|---|---|
176
+
| ISV Application | ISV:CompanyName:AppName:Version| Identify as ISV and include Company Name, App Name and Version name – separated by colon |
177
+
| Enterprise application | NONISV:CompanyName:AppName:Version| Identify as NONISV and include Company Name, App Name and Version name – separated by colon |
178
+
179
+
- If you are building your own JavaScript libraries, which are used to call SharePoint Online APIs, make sure that you include the User Agent information to your http request and potentially register your web application also as an Application, where suitable.
180
+
181
+
### Example of decorating traffic with User agent when using Client Side Object Model (CSOM)
182
+
183
+
```cs
184
+
// Get access to source site
185
+
using (varctx=newClientContext("https://contoso.sharepoint.com/sites/team"))
186
+
{
187
+
//Provide account and pwd for connecting to SharePoint Online
// Normal CSOM Call with custom User-Agent information
199
+
Website=ctx.Web;
200
+
ctx.Load(site);
201
+
ctx.ExecuteQuery();
202
+
}
203
+
```
204
+
205
+
### Example of decorating traffic with User agent when using REST APIs
206
+
207
+
Following sample is in c# format, but the similar User Agent information is recommended to be used even for the JavaScript libraries used in the SharePoint Online pages.
0 commit comments