id stringlengths 14 16 | text stringlengths 2 3.14k | source stringlengths 45 175 |
|---|---|---|
aeb5b9dc6eda-1 | Use remote event receivers
Use a background process
Use remote event receivers
In this pattern, remote event receivers fire when new documents are uploaded to SharePoint libraries. The remote event receivers make CSOM or REST API calls to set unique identifiers for documents.
This pattern executes immediate... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/document-id-provider-sharepoint-add-in |
aeb5b9dc6eda-2 | This pattern operates on all documents the code is written to crawl.
We suggest using the SharePoint search service to execute queries that include filters to return a list of documents that do not have unique identifiers set on them.
This pattern performs the fastest and scales better than any other query pattern... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/document-id-provider-sharepoint-add-in |
aeb5b9dc6eda-3 | Remote Timer Jobs (SharePoint Add-in Recipe)
Guidance articles at https://aka.ms/OfficeDevPnPGuidance
References in MSDN at https://aka.ms/OfficeDevPnPMSDN
Videos at https://aka.ms/OfficeDevPnPVideos
PnP samples
OD4B.NavLinksInjection (O365 PnP Sample)
Samples and content at Microsoft 365 Patterns a... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/document-id-provider-sharepoint-add-in |
b62b4341d567-0 | Summary
The approach you take to implement delegate controls in your code is different in the new SharePoint Add-in model than it was with Full Trust Code. In a typical Full Trust Code (FTC) / Farm Solution scenario, delegate controls were built as user controls or web controls, registered with features, and deploye... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/delegate-controls-sharepoint-add-in |
4ac5d6250e7d-0 | You can update your SharePoint site's UI by using JavaScript.
Applies to: Office 365 | SharePoint 2013 | SharePoint Online
Important
This extensibility option is only available for classic SharePoint experiences. You cannot use this option with modern experiences in SharePoint Online, like with communication... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/customize-your-sharepoint-site-ui-by-using-javascript |
4ac5d6250e7d-1 | In Figure 1, choosing Embed customization calls btnSubmit_Click in default.aspx. btnSubmit_Click calls AddJsLink , which does the following:
Creates a string representing a script block definition. This script block definition points to a JavaScript file (scenario1.js) which is included on all pages on the ... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/customize-your-sharepoint-site-ui-by-using-javascript |
4ac5d6250e7d-2 | StringBuilder scripts = new StringBuilder(@"
var headID = document.getElementsByTagName('head')[0];
var");
scripts.AppendFormat(@"
newScript = document.createElement('script');
newScript.type = 'text/javascript';
newScript.src... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/customize-your-sharepoint-site-ui-by-using-javascript |
4ac5d6250e7d-3 | newAction.ScriptBlock = scriptBlock;
newAction.Update();
ctx.Load(web, s => s.UserCustomActions);
ctx.ExecuteQuery();
}
SharePoint uses Minimal Download Strategy (MDS) to reduce the amount of data the browser downloads when users navigate between pages on a SharePoint site... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/customize-your-sharepoint-site-ui-by-using-javascript |
4ac5d6250e7d-4 | loadScript(jQuery, function () {
$(document).ready(function () {
var message = "<img src='/_Layouts/Images/STS_ListItem_43216.gif' align='absmiddle'> <font color='#AA0000'>JavaScript customization is <i>fun</i>!</font>"
// Execute status setter only after SP.JS has been loaded
... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/customize-your-sharepoint-site-ui-by-using-javascript |
cae03cbd9b97-0 | Add or remove a custom ribbon on your SharePoint site. Add JavaScript event handlers using the embed JavaScript technique to handle your custom ribbon's events.
Applies to: add-ins for SharePoint | SharePoint 2013 | SharePoint Online
The Core.RibbonCommands code sample shows you how to add a custom ribbon to a ... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/add-a-custom-ribbon-to-your-sharepoint-site |
cae03cbd9b97-1 | The custom ribbon displays on all sites and lists on the host web because RegistrationId="0x01" and RegistrationType="ContentType" . RegistrationId="0x01" and RegistrationType="ContentType" specify that the ribbon will appear for all content types that inherit from type "0x01" , which are content types that i... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/add-a-custom-ribbon-to-your-sharepoint-site |
cae03cbd9b97-2 | Size="OneLargeTwoMedium"/>
<MaxSize
Id="Ribbon.CustomRibbonTab.TabTwoMaxSize"
GroupId="Ribbon.CustomRibbonTab.NewOpenCustomGroup"
Size="TwoLarge" />
<Scale
Id="Ribbon.CustomRibbonTab.Scaling.CustomTabScaling"
Gro... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/add-a-custom-ribbon-to-your-sharepoint-site |
cae03cbd9b97-3 | Command="CustomRibbonTab.RejectCustomCommand"
Sequence="17"
Image16by16="{SiteUrl}/_layouts/15/1033/Images/formatmap16x16.png?rev=23"
Image16by16Top="-216"
Image16by16Left="-290"
Description="Reject Item"
... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/add-a-custom-ribbon-to-your-sharepoint-site |
cae03cbd9b97-4 | Image32by32Top="-442"
Image32by32Left="-67"
Description="Copy Item"
LabelText="Copy"
TemplateAlias="CPWR"/>
</Controls>
</Group>
<Group
Id="Ribbon.CustomRibbonTab.NewOpenCustomGroup"
... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/add-a-custom-ribbon-to-your-sharepoint-site |
cae03cbd9b97-5 | <CommandUIDefinition Location="Ribbon.Templates._children">
<GroupTemplate Id="Ribbon.Templates.CustomTemplate">
<Layout
Title="OneLargeTwoMedium"
LayoutTitle="OneLargeTwoMedium">
<Section Alignment="Top" Type="OneRow">
<Row>
... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/add-a-custom-ribbon-to-your-sharepoint-site |
cae03cbd9b97-6 | </Layout>
</GroupTemplate>
</CommandUIDefinition>
</CommandUIDefinitions>
<CommandUIHandlers>
<CommandUIHandler
Command="CustomRibbonTab.AcceptCustomCommand"
CommandAction="javascript:GetCurrentItem('AP');"/>
<CommandUIHandler
Command="CustomRi... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/add-a-custom-ribbon-to-your-sharepoint-site |
cae03cbd9b97-7 | Reads several elements and attribute values from the CustomAction object.
Converts the CommandUIExtension element (which defines the ribbon groups, buttons, and UI event handlers) to a string called xmlContent .
Creates a new custom action by using clientContext.Web.UserCustomActions.Add .
Adds the ... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/add-a-custom-ribbon-to-your-sharepoint-site |
cae03cbd9b97-8 | using (var clientContext = spContext.CreateUserClientContextForSPHost()) {
clientContext.Load(clientContext.Web, web => web.UserCustomActions);
clientContext.ExecuteQuery();
// Get the XML elements file and get the CommandUIExtension node.
var customActio... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/add-a-custom-ribbon-to-your-sharepoint-site |
cae03cbd9b97-9 | customAction.Update();
clientContext.Load(customAction);
clientContext.ExecuteQuery();
}
}
See also
Office 365 development patterns and practices solution guidance
Customize your SharePoint site UI by using JavaScript
Customizing and Extending the S... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/add-a-custom-ribbon-to-your-sharepoint-site |
24de44a94a22-0 | Summary
The approach you take to provide customized end user experiences is different in the new SharePoint Add-in model than it was with Full Trust Code. In a typical Full Trust Code (FTC) / Farm Solution scenario, custom field types were created with the SharePoint server-side object model code by inheriting from o... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/custom-field-type-sharepoint-add-in |
24de44a94a22-1 | Setting JSLink property to host web requires at least full permission at web level, so this approach is not suitable for add-ins at the SharePoint store
Options to implement client-side rendering with JavaScript files via the JSLink property
You have a couple of options to implement client-side rendering with Jav... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/custom-field-type-sharepoint-add-in |
24de44a94a22-2 | Branding.ClientSideRendering (O365 PnP Sample)
Includes 9 samples that set the JSLink property on a SharePoint List View web part and an explanation of how each sample was implemented.
The RegisterJStoWebPart method sets the List View web part's JSLink property.
Set the JSLink property for a SharePoint fi... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/custom-field-type-sharepoint-add-in |
24de44a94a22-3 | Not all SharePoint fields may be overridden with the JSLink property.
The TaxonomyField is a good example.
JSLink supports several tokens.
_layouts
_site
_siteCollection
_siteCollectionLayouts
_siteLayouts
You can register the JSLink JavaScript files with the SharePoint Script On Demand (SOD... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/custom-field-type-sharepoint-add-in |
24de44a94a22-4 | References in MSDN at https://aka.ms/OfficeDevPnPMSDN
Videos at https://aka.ms/OfficeDevPnPVideos
PnP samples
Branding.ClientSideRendering (O365 PnP Sample)
Branding.JSLink (O365 PnP Sample)
Samples and content at https://github.com/SharePoint/PnP
Applies to
Office 365 Multi Tenant (MT)
Offic... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/custom-field-type-sharepoint-add-in |
e1fa37029d2c-0 | Summary
The approach you take to modify list item menus and the ribbon in SharePoint is different in the new SharePoint Add-in model than it was with Full Trust Code. In a typical Full Trust Code (FTC) / Farm Solution scenario, list item menus and ribbon modifications were defined in XML (custom actions), packaged in... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/custom-actions-sharepoint-add-in |
e1fa37029d2c-1 | Getting started
The following sample demonstrates how to add a custom action to the site settings menu in the host web, how to show a dialog in a custom action, how to hide a dialog that hosts a page from a remote add-in web, and how to use a custom action to create lists and set the theme of a web.
Provisioning.... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/custom-actions-sharepoint-add-in |
86def0d98e93-0 | The approach you take to brand SharePoint sites is different in the new SharePoint Add-in model than it was with Full Trust Code / Farm Solutions. In a typical Full Trust Code (FTC) / Farm Solution branding scenario, custom master pages, web templates, JavaScript, CSS files, and images are created to implement a custo... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/branding-sharepoint-sites-sharepoint-add-in |
86def0d98e93-1 | Why would you custom brand a SharePoint site?
There are many different reasons why you would apply custom branding to a SharePoint site. These reasons can include corporate identity, usability, marketing, etc.
As a rule of a thumb, we would like to provide the following high-level guidelines for custom branding Sh... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/branding-sharepoint-sites-sharepoint-add-in |
86def0d98e93-2 | This example comes from the Theme management using CSOM (O365 PnP Sample) .
Challenges applying brand customization to SharePoint sites
Office 365 themes vs. SharePoint themes
It is important to understand that Office 365 themes and SharePoint themes are different. It is also important to understand SharePoin... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/branding-sharepoint-sites-sharepoint-add-in |
86def0d98e93-3 | background image
master page
master page preview
See the Themes overview for SharePoint 2013 article to learn more about these components.
Composed looks used for Office 365 SharePoint sites include one or more of the following components.
color palette (.spcolor file) - Also referred to as a SharePoin... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/branding-sharepoint-sites-sharepoint-add-in |
86def0d98e93-4 | Use an Office 365 theme to brand a SharePoint site.
Change the composed look for a SharePoint site.
Use the SharePoint color palette tool to create a color palette for a SharePoint theme.
Use Alternate CSS to brand a SharePoint site.
Create a color scheme for a SharePoint theme manually.
Create a font scheme ... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/branding-sharepoint-sites-sharepoint-add-in |
86def0d98e93-5 | Change the composed look for a SharePoint site
Changing a SharePoint site's composed look is another easy way to apply branding to a SharePoint site.
Composed looks are accessed in the Site Settings page.
SharePoint ships with several composed looks to choose from.
Composed looks exist in both Office 365 tena... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/branding-sharepoint-sites-sharepoint-add-in |
86def0d98e93-6 | Custom color schemes provide a fair amount of flexibility to brand a SharePoint site.
You can apply color schemes via composed looks at a per site level.
When is creating custom color scheme for SharePoint sites a good fit?
This option works well when your branding needs include a new color scheme but do not re... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/branding-sharepoint-sites-sharepoint-add-in |
86def0d98e93-7 | Create a color scheme for a SharePoint theme manually
You can also create a .spcolor file manually with a text editor such as Notepad or Visual Studio. You can see an example snippet from a .spcolor file is shown below.
<?xml version="1.0" encoding="utf-8"?>
<s:colorPalette isInverted="false" previewSlot1="Backgro... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/branding-sharepoint-sites-sharepoint-add-in |
86def0d98e93-8 | <?xml version="1.0" encoding="utf-8"?>
<s:fontScheme name="Bodoni" previewSlot1="title" previewSlot2="body" xmlns:s="http://schemas.microsoft.com/sharepoint/">
<s:fontSlots>
<s:fontSlot name="title">
<s:latin typeface="Bodoni Book" eotsrc="/_layouts/15/fonts/BodoniBook.eot" woffsrc="/_layouts/15... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/branding-sharepoint-sites-sharepoint-add-in |
86def0d98e93-9 | Use JavaScript embedding to show and hide components on a SharePoint site
You can use JavaScript embedding to apply custom branding to SharePoint sites. JavaScript embedding registers JavaScript to execute for all pages on a SharePoint site. Under the hood, JavaScript embedding relies on custom actions assigned to ... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/branding-sharepoint-sites-sharepoint-add-in |
86def0d98e93-10 | Create custom master pages and page layouts for a SharePoint site
In scenarios where a custom master page is the only way to implement your custom branding requirements you can create a custom master page and page layouts. Keep in mind the points made at the beginning of this article with regard to the long-term mai... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/branding-sharepoint-sites-sharepoint-add-in |
86def0d98e93-11 | Create a composed look for a SharePoint Site
A composed look includes the .spcolor and .spfont files described above. It also include a master page and a background image. A composed look is not a packaged asset that you deploy to a SharePoint site. Rather, a composed look is a list item in a special SharePoint li... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/branding-sharepoint-sites-sharepoint-add-in |
86def0d98e93-12 | Specific challenges with chosen path
Following bullet points are pointing out specific challenges with chosen pattern, which should be also considered when the branding approach for your deployment is decided.
Office 365 themes are highly limited and mainly control the suite navigation section of the page
Share... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/branding-sharepoint-sites-sharepoint-add-in |
86def0d98e93-13 | Setting a SharePoint Theme in an App for SharePoint (O365 PnP Sample)
Making out-of-the-box Seattle master responsive (O365 PnP Sample)
AlternateCSSUrl and SiteLogoUrl Properties in the web object (O365 PnP Sample)
Samples and content at https://github.com/SharePoint/PnP
Applies to
Office 365 Multi Tenan... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/branding-sharepoint-sites-sharepoint-add-in |
9ed123a13ae6-0 | The approach you take to elevate privileges in your code is different in the new SharePoint Add-in model than it was with full trust code. In a typical full trust code (FTC) / Farm Solution scenario, the RunWithElevatedPrivileges API is used with the SharePoint server-side object model code and deployed via Farm Soluti... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/app-only-elevated-privileges-sharepoint-add-in |
9ed123a13ae6-1 | using (var ctx = TokenHelper.GetClientContextWithAccessToken(siteUrl.ToString(), token))
{
// Perform operations using the app only token access.
}
}
catch (Exception ex)
{
Console.WriteLine("Error in execution: " + ex.Message);
}
When using the AllowAppOnlyPolicy, keep in mind it only wo... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/app-only-elevated-privileges-sharepoint-add-in |
9ed123a13ae6-2 | // Use default authentication mode
context.AuthenticationMode = ClientAuthenticationMode.Default;
// Specify the credentials for the account that will execute the request
context.Credentials = new SharePointOnlineCredentials("User Name", "Password");
}
Options to elevate permissions
You have a couple... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/app-only-elevated-privileges-sharepoint-add-in |
9ed123a13ae6-3 | The following article demonstrates how to use AllowAppOnlyPolicy with S2S.
SharePoint 2013 App Only Policy Made Easy (Kirk Evans - MSDN Blog Post)
ACS sub option
The ACS sub option work in on-premises and Office 365 SharePoint environments.
When authenticating via OAuth in an ACS scenario the TokenHelper::... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/app-only-elevated-privileges-sharepoint-add-in |
9ed123a13ae6-4 | Service Account
In this pattern, the SharePointOnlineCredentials class is used to establish the context of a user that executes code.
When is it a good fit?
When you need to execute code on behalf of a specific user (service account) this is a good option because it performs actions on the user's (service account... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/app-only-elevated-privileges-sharepoint-add-in |
9ed123a13ae6-5 | SharePoint 2013 on-premises – partly
Patterns for dedicated and on-premises are identical with SharePoint Add-in model techniques, but there are differences on the possible technologies that can be used. | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/app-only-elevated-privileges-sharepoint-add-in |
6c7b3ba50b97-0 | The articles in this section show you how to use the SharePoint Add-in model to customize your SharePoint sites. The following table lists the articles that are included.
Article
Shows you how to use the add-in model to
App-Only and Elevated privileges
Elevate privileges.
Branding SharePoint... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/sharepoint-add-in-recipes |
6c7b3ba50b97-1 | Implement custom master pages in SharePoint sites.
MMS manipulation
Perform Create, Read, Update, and Delete (CRUD) operations in the Managed Metadata Service (MMS).
Modules
Deploy artifacts to a SharePoint environment.
OneDrive for Business customization
Customize OneDrive for Business sites.
... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/sharepoint-add-in-recipes |
6c7b3ba50b97-2 | Connected SharePoint app parts
Implement real-time communication between SharePoint app parts by using SignalR.
Workflows, Actions (Activities), Events, and Forms
Implement workflows and their associated components.
Yammer Integration
Integrate Yammer with SharePoint.
See also
Office 365 d... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/sharepoint-add-in-recipes |
681bd2f99e11-0 | Years ago, ASP.NET gave us server-side UI control rendering, and it was good. That server-side rendering, however, requires full trust code. Now that we have transitioned to SharePoint and Office 365, full trust code is no longer an option. That means server-side UI control rendering won't work for us any more.
Yet, ... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/javascript-patterns-and-performance |
681bd2f99e11-1 | ScriptEditor Webpart
Include script directly or loaded through script tags with markup to create complex single page applications hosted entirely within the SharePoint site
Don't think you are locked into these choices if you feel a different option would be better for your situation.
JavaScript Performance... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/javascript-patterns-and-performance |
681bd2f99e11-2 | Reduce the number of requests
Always make the fewest and smallest requests possible. Each request you eliminate reduces the performance burden on the server and on the client. And making smaller requests further reduces the performance burden.
There are several ways to reduce requests and reduce request size.
L... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/javascript-patterns-and-performance |
681bd2f99e11-3 | Request only the fields you need, like Name and Address, not the entire record.
Make specific, deliberate filter requests. For example, if you want to list the available articles, get the Title, PublishingDate, and Author. Leave the rest of the fields out of the request.
Provide a good user experience
Jerky, in... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/javascript-patterns-and-performance |
681bd2f99e11-4 | There are three different places you can cache your data:
Option
Description
Session Storage
Stores data as a key/value pair on the client. This is per session storage which is always stored as strings. JSON.stringify() will convert your JavaScript objects to strings which helps to store objec... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/javascript-patterns-and-performance |
681bd2f99e11-5 | The Price of Popularity
How often is your page viewed? In the classic scenario, the corporate home page is set as the launch page for all browsers across the organization. Then you suddenly get far more traffic than you ever imagined. Every byte of content is suddenly magnified in the server performance and bandwidth... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/javascript-patterns-and-performance |
681bd2f99e11-6 | SP.SOD.registerSod('pnp-jquery.js', 'https://localhost:44324/js/jquery.js');
SP.SOD.registerSod('pnp-loader.js', url);
SP.SOD.registerSodDep('pnp-loader.js', 'pnp-jquery.js');
SP.SOD.executeFunc('pnp-loader.js', null, functi... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/javascript-patterns-and-performance |
681bd2f99e11-7 | // this version of the script along with pnp-loaderMDS.js (or pnp-loaderMDS-cached.js) handles pages where the minimum download strategy is active
var script2 = @"ExecuteOrDelayUntilBodyLoaded(function () {
var url = 'https://localhost:44324/js/pnp-loaderMDS.js?' + encodeURIComponent... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/javascript-patterns-and-performance |
681bd2f99e11-8 | if (doDelete)
{
context.ExecuteQueryRetry();
}
// now we embed our script into the user custom action
var newLink = context.Site.RootWeb.UserCustomActions.Add();
newLink.Title = "MyTestCustomAction";
newLink.Description = "Doing some testing.";
newLin... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/javascript-patterns-and-performance |
681bd2f99e11-9 | // get the next file to load
var file = self.files.shift();
var fullPath = urlbase + file;
// load the remote script file
$.getScript(fullPath).done(function () {
if (self.files.length > 0) {
engine.call(self);
}
else {
... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/javascript-patterns-and-performance |
681bd2f99e11-10 | // give back the promise
return promise.promise();
})().done(function () {
/* all scripts are loaded and I could take actions here */
}).fail(function () {
/* something failed, take some action here if needed */
});
The pnp-loader.js file does not cache, which works well for a development environment. T... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/javascript-patterns-and-performance |
681bd2f99e11-11 | self._currentUserInfoPromise = $.Deferred(function (def) {
var cachingTest = $pnp.session !== 'undefined' && $pnp.session.enabled;
// if we have the caching module loaded
if (cachingTest) {
var userInfo = $pnp.session.get(self._currentUserInfoCacheKe... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/javascript-patterns-and-performance |
681bd2f99e11-12 | return this._currentUserInfoPromise.promise();
}
}
Caching pattern using asynchronous and Deferred
Another caching pattern can be found in pnp-clientcache.js storageTest, which is taken from the modernizer storageTest. It contains functions for add, get, remove, and getOrAdd which will return the cached data i... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/javascript-patterns-and-performance |
681bd2f99e11-13 | if (this.enabled) {
localStorage.removeItem(key);
}
},
// gets an item from the cache or adds it using the supplied getter function
getOrAdd: function (/*string*/ key, /*function*/ getter) {
if (!this.enabled) {
return getter();
}
if (!$.isFunction(... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/javascript-patterns-and-performance |
d23b8144110a-0 | You can control external sharing settings on a SharePoint site collection in Office 365, allowing external users (users who don't have an organization account in your Office 365 subscription) access to your site collection.
Applies to: add-ins for SharePoint | SharePoint Online | Office 365
The Core.ExternalShar... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/set-external-sharing-on-site-collections-in-office-365 |
d23b8144110a-1 | On the ribbon, choose Sharing .
Review your external sharing settings in the sharing dialog. After running the code sample, return to the sharing dialog to verify that your external sharing settings changed.
When you run this code sample, Main in Program.cs performs the following tasks:
Gets the... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/set-external-sharing-on-site-collections-in-office-365 |
d23b8144110a-2 | /* End Program if no Office 365 admin center URL is supplied*/
if (string.IsNullOrEmpty(tenantAdminURL))
{
Console.WriteLine("Hmm, i tried to work on it but you didn't supply your admin tenant url:");
return;
}
// Prompt the... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/set-external-sharing-on-site-collections-in-office-365 |
d23b8144110a-3 | Console.WriteLine("Hit Enter to exit.");
Console.Read();
}
SetSiteSharing does the following:
Uses the Tenant.GetSitePropertiesByUrl to retrieve SiteProperties on your site collection.
Uses Tenant.SharingCapability to determine whether external sharing is enabled on your... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/set-external-sharing-on-site-collections-in-office-365 |
d23b8144110a-4 | if(_tenantSharing == SharingCapabilities.Disabled)
{
Console.WriteLine("Sharing is currently disabled in your tenant! I am unable to work on it.");
}
else
{
if(shareSettings == SharingCapabilities.Disabled)
{ _isUpdatable ... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/set-external-sharing-on-site-collections-in-office-365 |
7e4468361fcd-0 | The developer experience has changed for SharePoint Provider-hosted Add-ins that require Tenant permission in combination with app-only . This article walks you through the new experience for developing and debugging these solutions.
Applies to: Provider Hosted Add-ins for SharePoint Online
Understanding the Pr... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/development-experience-tenant-apponly-permissions-in-sharepoint-online |
7e4468361fcd-1 | Right click on the SharePoint Add-in project and click publish.
Supply the Client ID and Client Secret created in Step 1.
Since you want to debug the add-in, ensure that you supply https://localhost including the port as shown below.
Now deploy the add-in in the app catalog site.
Step 5: Install your ... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/development-experience-tenant-apponly-permissions-in-sharepoint-online |
53c009ff81ec-0 | Use the app-only policy or service accounts to elevate privileges in SharePoint Add-ins or other remotely hosted solutions.
Applies to: apps for SharePoint | SharePoint 2013 | SharePoint Add-ins | SharePoint Online
Different methods are used to elevate privileges in SharePoint Add-ins and farm solutions. Farm solu... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/elevated-privileges-in-sharepoint-add-ins |
53c009ff81ec-1 | For more information, see App authorization policy types in SharePoint 2013 .
Note
The app-only policy is available only for provider-hosted add-ins. SharePoint-hosted add-ins that access the host web must use the user+app policy.
Benefits of using the app-only policy in your add-in include:
You do not n... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/elevated-privileges-in-sharepoint-add-ins |
53c009ff81ec-2 | Low-trust authorization
Your add-in can use low-trust authorization when using the Microsoft Azure Access Control Service (ACS) to establish trust between your provider-hosted add-in and either your Office 365 site or your on-premises SharePoint farm. You can learn more at Three authorization systems for SharePoint ... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/elevated-privileges-in-sharepoint-add-ins |
53c009ff81ec-3 | string realm = TokenHelper.GetRealmFromTargetUrl(siteUrl);
var token = TokenHelper.GetAppOnlyAccessToken(TokenHelper.SharePointPrincipal, siteUrl.Authority, realm).AccessToken; | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/elevated-privileges-in-sharepoint-add-ins |
53c009ff81ec-4 | using (var ctx = TokenHelper.GetClientContextWithAccessToken(siteUrl.ToString(), token))
{
// Perform operations on the ClientContext object, which uses the app-only token.
}
}
catch (Exception ex)
{
Console.WriteLine("Error in execution: " + ex.Message);
}
High-trust authorization
If your add... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/elevated-privileges-in-sharepoint-add-ins |
53c009ff81ec-5 | Note
Add-ins purchased from the Office Store cannot use service accounts.
The following code shows how to authenticate by using SharePointOnlineCredentials with a service account.
using (ClientContext context = new ClientContext("https://contoso.sharepoint.com"))
{ | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/elevated-privileges-in-sharepoint-add-ins |
53c009ff81ec-6 | // Use default authentication mode.
context.AuthenticationMode = ClientAuthenticationMode.Default;
// Specify the credentials for the service account.
context.Credentials = new SharePointOnlineCredentials("User Name", "Password");
}
See also
Office 365 development patterns and practices solution g... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/elevated-privileges-in-sharepoint-add-ins |
a48ddf7a8e8e-0 | Use images across domains in provider-hosted add-ins.
Applies to: SharePoint 2013 | SharePoint Add-ins | SharePoint Online
You might want to display images from a SharePoint site in your provider-hosted add-ins. Because provider-hosted add-ins run on a remote web, the domains for your provider-hosted add-in and yo... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/cross-domain-images-in-sharepoint-provider-hosted-add-ins |
a48ddf7a8e8e-1 | Note
Image 1 does not render because the add-in crosses domains to get to the image in SharePoint. Notice that the URL of the provider-hosted add-in runs on localhost. Open the shortcut menu (right-click) for Image 1, and then choose Properties . Notice that the Address (URL) is trying to retrieve the image from t... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/cross-domain-images-in-sharepoint-provider-hosted-add-ins |
a48ddf7a8e8e-2 | {
var spContext = SharePointContextProvider.Current.GetSharePointContext(Context);
using (var clientContext = spContext.CreateUserClientContextForSPAppWeb())
{
// Set the access token in a hidden field for client-side code to use.
hdnAccessToken.Value ... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/cross-domain-images-in-sharepoint-provider-hosted-add-ins |
a48ddf7a8e8e-3 | // Set the URLs to the images.
Image1.ImageUrl = spContext.SPAppWebUrl + "AppImages/O365.png";
Services.ImgService svc = new Services.ImgService();
Image2.ImageUrl = svc.GetImage(spContext.UserAccessTokenForSPAppWeb, spContext.SPAppWebUrl.ToString(), "AppImages", "O365.pn... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/cross-domain-images-in-sharepoint-provider-hosted-add-ins |
a48ddf7a8e8e-4 | sourceSteam.CopyTo(newStream);
byte[] bytes = newStream.ToArray();
return "data:image/png;base64, " + Convert.ToBase64String(bytes);
}
}
}
}
After Page_Load finishes, Default.aspx runs the client-side code in De... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/cross-domain-images-in-sharepoint-provider-hosted-add-ins |
a48ddf7a8e8e-5 | $.ajax({
url: '../Services/ImgService.svc/GetImage?accessToken=' + $('#hdnAccessToken').val() + '&site=' + encodeURIComponent(appWebUrl + '/') + '&folder=AppImages&file=O365.png',
dataType: 'json',
success: function (data) {
$('#Image3').at... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/cross-domain-images-in-sharepoint-provider-hosted-add-ins |
c16e0fa407ae-0 | Provide authorized access to SharePoint resources by using OAuth in provider-hosted add-ins at run time.
Applies to: SharePoint 2013 | SharePoint Add-ins | SharePoint Online
Your users can access SharePoint add-ins by opening a SharePoint site, choosing Site Contents , and then choosing the add-in. SharePoint re... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/authorize-provider-hosted-add-in-users-at-run-time-by-using-oauth |
c16e0fa407ae-1 | Register the add-in on a SharePoint site by using AppRegNew.aspx:
Navigate to appregnew.aspx on your SharePoint site. For example, if you want to use your add-in on the contoso.sharepoint.com site, navigate to http://contoso.sharepoint.com/_layouts/15/appregnew.aspx .
Choose Generate to generate a new Clie... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/authorize-provider-hosted-add-in-users-at-run-time-by-using-oauth |
c16e0fa407ae-2 | Note
Your user must have Manage permissions to grant consent to the permissions the add-in is requesting. You can learn more at Authorization Code OAuth flow for SharePoint Add-ins .
In Successfully connected to Contoso , enter the name of a new list to create, and then choose Create List .
Verify t... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/authorize-provider-hosted-add-in-users-at-run-time-by-using-oauth |
c16e0fa407ae-3 | Note
TokenHelper.GetAuthorizationUrl returns a URL of the form https://contoso.sharepoint.com/_layouts/15/OAuthAuthorize.aspx?IsDlg=1 &client_id=<Client ID>&scope=Web.Manage&response_type=code , where <Client ID> is the add-in's Client ID. If your add-in is registered through the Seller Dashboard, any Office 365 ... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/authorize-provider-hosted-add-in-users-at-run-time-by-using-oauth |
c16e0fa407ae-4 | repository.Callback(code);
return RedirectToAction("Index");
}
TokenRepository.Callback calls TokenCache.UpdateCacheWithCode , which uses TokenHelper.GetAccessToken to obtain an OAuth access token based on the authorization code, code .
public void Callback(string code)
{
... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/authorize-provider-hosted-add-in-users-at-run-time-by-using-oauth |
07ed74c5eb1b-0 | Most of the SharePoint Online tenants handles the file open experience using the strict model. As a result, all files which can potentially cause harm (e.g. a html file having embedded script) are not executed in the browser but downloaded or shown as raw content (html preview in the modern user experience). If your ... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/security-permissivesetting |
07ed74c5eb1b-1 | Step 1: Assess the impact
Understanding which files are impacted is a first step and you can do that via the permissive file scanner. See the SharePoint Permissive Scanner to learn more about the scanner and how to use it. In the default configuration this scanner searches for html/html files, but using the command... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/security-permissivesetting |
07ed74c5eb1b-2 | For these html/html files the remediation is simple: if a user/app with site owner or site collection admin permissions renames the html/htm files to ASPX files then these files do open again. Below SharePoint PnP PowerShell shows a how this can be done. Assume you’ve a html file with following url: https://contoso.... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/security-permissivesetting |
07ed74c5eb1b-3 | What about embedded links to other html/htm files?
My html/htm files link to other html/htm files in the same folder or in a subfolder…will these links break if the files are renamed to aspx? If the underlying rename is done using the MoveTo API call then most of the relative links inside the html file are automatica... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/security-permissivesetting |
07ed74c5eb1b-4 | What about sites having the “noscript” feature enabled
All “modern” sites (modern team site, communication site) have the “noscript” feature turned on by default. The result of this is that no one will have the AddAndCustomizePages (ACP) permission, so no one can perform a successful rename from html/htm to aspx. Typ... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/security-permissivesetting |
07ed74c5eb1b-5 | Remediation of other file types
Html/htm files are the major reason for customers to use the permissive mode but what about other file types? For the many common file formats SharePoint Online does offer a preview capability as explained in this blog . SharePoint Online can preview the following formats:
Documents... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/security-permissivesetting |
07ed74c5eb1b-6 | abap, ada, adp, ahk, as, as3, asc, ascx, asm, asp, awk, bash, bash_login, bash_logout, bash_profile, bashrc, bat, bib, bsh, build, builder, c, c++, capfile, cc, cfc, cfm, cfml, cl, clj, cls, cmake, cmd, coffee, cpp, cpt, cpy, cs, cshtml, cson, csproj, css, ctp, cxx, d, ddl, di, dif, diff, disco, dml, dtd, dtml, el, ema... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/security-permissivesetting |
07ed74c5eb1b-7 | rhtml, rjs, rprofile, rpy, rss, rst, rxml, s, sass, scala, scm, sconscript, sconstruct, script, scss, sgml, sh, shtml, sml, sql, sty, tcl, tex, text, textile, tld, tli, tmpl, tpl, txt, vb, vi, vim, wsdl, xhtml, xml, xoml, xsd, xsl, xslt, yaml, yaws, yml, zip, zsh | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/security-permissivesetting |
07ed74c5eb1b-8 | Sample script that can remediate a complete site collection
This script can be used as a starting basis for a site collection scoped remediation. The script will do the following:
Install PnP-PowerShell if not yet installed
Use search to find all the html/htm files in the site collection
Rename those files to... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/security-permissivesetting |
07ed74c5eb1b-9 | function PermissiveRemediateASiteCollection
{
param([string] $siteCollectionUrl, [string] $winCredentialsManagerLabel)
$siteCollectionUrl = $siteCollectionUrl.TrimEnd("/");
# Gets or Sets the tenant admin credentials.
$credentials = $null
if(![String]::IsNullOrEmpty($winCredentialsManagerLabe... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/security-permissivesetting |
07ed74c5eb1b-10 | # if no files were found then bail out
if ($htmlFiles.RowCount -eq 0)
{
Write-Host "No files found to remediate...exiting the script" -ForegroundColor Green
exit 0
}
else
{
Write-Host "Found" $htmlFiles.RowCount "files to remediate" -ForegroundColor Green
}
# Create ... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/security-permissivesetting |
07ed74c5eb1b-11 | # Get new file name and server relative path
$newFileName = $serverRelativePath.Substring($serverRelativePath.LastIndexOf("/") + 1).ToLower()
$serverRelativePathNew = $serverRelativePath
if ($newFileName.EndsWith(".html"))
{
$newFileName = $newFileName.Rep... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/security-permissivesetting |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.