id
stringlengths
14
16
text
stringlengths
2
3.14k
source
stringlengths
45
175
3e5454f35810-3
Right-click Core.EventReceivers > Properties > SharePoint . Select Enable debugging via Microsoft Azure Service Bus . In Microsoft Azure Service Bus connection string , paste the Connection String. Choose Save . Run the code sample, and perform the following additional steps: Click T...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/use-remote-event-receivers-in-sharepoint
3e5454f35810-4
The ProcessEvent handles the following SPRemoteEventType remote events: AppInstalled events when installing the add-in. When an AppInstalled event occurs, ProcessEvent calls HandleAppInstalled . AppUninstalling events when uninstalling the add-in. When an AppUninstalling event occurs, ProcessEven...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/use-remote-event-receivers-in-sharepoint
3e5454f35810-5
SPRemoteEventResult result = new SPRemoteEventResult(); switch (properties.EventType) { case SPRemoteEventType.AppInstalled: HandleAppInstalled(properties); break; case SPRemoteEventType.AppUninstalling: ...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/use-remote-event-receivers-in-sharepoint
3e5454f35810-6
return result; } HandleAppInstalled calls RemoteEventReceiverManager.AssociateRemoteEventsToHostWeb in RemoteEventReceiverManager.cs. private void HandleAppInstalled(SPRemoteEventProperties properties) { using (ClientContext clientContext = TokenHelper.CreateAppEvent...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/use-remote-event-receivers-in-sharepoint
3e5454f35810-7
{ // Add Push Notification feature to host web. // Not required but it is included here to show you // how to activate features. clientContext.Web.Features.Add( new Guid("41e1d4bf-b1a2-47f7-ab80-d5d6cbba3092"), true, FeatureDefini...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/use-remote-event-receivers-in-sharepoint
3e5454f35810-8
// Get the Title and EventReceivers lists. clientContext.Load(clientContext.Web.Lists, lists => lists.Include( list => list.Title, list => list.EventReceivers).Where (list => list.Title == LIST_TITLE)); clientContex...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/use-remote-event-receivers-in-sharepoint
3e5454f35810-9
System.Diagnostics.Trace.WriteLine("Added ItemAdded receiver at " + receiver.ReceiverUrl); } } When an item is added to the Remote Event Receiver Jobs list, ProcessEvent in AppEventReceiver.svc.cs handles the ItemAdded event, and then calls HandleItemAdded . HandleItemAdded calls Remo...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/use-remote-event-receivers-in-sharepoint
79f695f08662-0
The approach you take to implement timer jobs 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, SharePoint Timer Jobs were created with the SharePoint Server Side Object Model code, deployed via Farm Solutions and managed in t...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/remote-timer-jobs-sharepoint-add-in
79f695f08662-1
Options to schedule timer jobs You have a couple of options to implement the scheduling for a timer job. Windows Scheduler Windows Service Azure WebJob Azure worker process Windows Scheduler In this pattern, the Windows Scheduler handles the scheduling aspects associated with a timer job. I...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/remote-timer-jobs-sharepoint-add-in
79f695f08662-2
Does not require additional hardware to run the Azure WebJob (scheduling and implementation code). Advantageous because it uses the Azure WebJob for scheduling as well as the implementation code, which makes it easy to manage in one location. Azure Worker Role Sub Option An Azure Worker Role has the same charac...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/remote-timer-jobs-sharepoint-add-in
79f695f08662-3
Create clear and descriptive names for the service accounts so you can easily track the operations they perform. For example: If your timer job modifies list items, the Modified By column for the list items will display the name of the service account associated with the timer job. When authenticating with serv...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/remote-timer-jobs-sharepoint-add-in
79f695f08662-4
When using a SharePoint application to authenticate you create an app principal and assign permissions to it. In this pattern, timer jobs may be implemented via a Provider-hosted SharePoint Add-in or a console application. To register an app principal for the Provider-hosted SharePoint Add-in or console applicati...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/remote-timer-jobs-sharepoint-add-in
79f695f08662-5
using(var clientContext = TokenHelper.GetClientContextWithAccessToken(siteUri.ToString(),accessToken)) { //Implement timer job code } When using an Azure Active Directory application to authenticate, you create an Azure Active Directory application in the Azure portal and assign permissions to it. In t...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/remote-timer-jobs-sharepoint-add-in
79f695f08662-6
Provisioning.Services.SiteManager (O365 PnP Sample) Provisioning.SiteCollectionCreation (O365 PnP Sample) Samples and content at https://github.com/SharePoint/PnP Applies to Office 365 Multi Tenant (MT) Office 365 Dedicated (D) partly SharePoint 2013 on-premises – partly Patterns for dedicated an...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/remote-timer-jobs-sharepoint-add-in
1132aa911849-0
The approaches you take to ensure optimal performance with 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 most code operations took place in the SharePoint Server-side Object Model code. In an SharePoint Add-in m...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/performance-considerations-sharepoint-add-in
1132aa911849-1
Use client-side caching Use server-side caching Use client-side caching In this pattern, client-side caching techniques such as HTML5 LocalStorage and cookies are used to cache data. Information stored in these locations is used to determine if it is necessary to make API calls to a SharePoint server. This ...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/performance-considerations-sharepoint-add-in
1132aa911849-2
// Check for existing expiration stamp var existingStamp = localStorage.getItem(key + expiryKeySuffix); // Override cached setting if a user has entered a value that is different than what is stored if (expiryConfig != null) { var currentTime = Math.floor((new Date().getTime()) / 1000); ...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/performance-considerations-sharepoint-add-in
1132aa911849-3
if (currentTime - parseInt(expiryStamp) > parseInt(expiryConfig)) { cachingStatus += "\n" + "The " + key + " key time stamp has expired..."; $('#status').val(cachingStatus); return true; } else { var estimatedSeconds = parseInt(expiryStamp) - currentTime; ...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/performance-considerations-sharepoint-add-in
1132aa911849-4
This pattern uses server-side code to evaluate data stored in cookies. Cookies are limited to storing 4095 bytes of data. Cookies have a built-in data expiration mechanism. See the CookieCheckSkip method in the Customizer.aspx.cs Class in the OD4B.Configuration.Async (O365 PnP Sample) to see how serve...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/performance-considerations-sharepoint-add-in
1132aa911849-5
Applying customized OneDrive for Business configurations are a good example of such a scenario. Getting started The Performance.Caching (O365 PnP Sample) describes how to implement both LocalStorage and cookie-based client-side caching in the Add-in model and provides links to several samples and articles. ...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/performance-considerations-sharepoint-add-in
d9ab1da8000c-0
The approach you take to customize OneDrive for Business sites in the new SharePoint Add-in model is different than it was with Full Trust Code. In a typical Full Trust Code (FTC) / Farm Solution scenario, SharePoint Timer Jobs were created with the SharePoint Server Side Object Model code, deployed via Farm Solutions...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/onedrive-for-business-customization-sharepoint-add-in
d9ab1da8000c-1
We do not recommend usage of content types and site columns in OD4B sites to avoid challenges with the required fields or other elements, which could cause issues for normal use cases with OD4B sites Think OD4B sites as for personal unstructured data and documents. Team sites and collaboration sits are then for comp...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/onedrive-for-business-customization-sharepoint-add-in
d9ab1da8000c-2
Classic solution to apply needed configuration to the OneDrive for Business sites (including my or personal sites) was based on feature stapling in farm level. This meant that you deployed farm solution to your SharePoint farm and used feature framework to associate your custom feature to be activated each time a my si...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/onedrive-for-business-customization-sharepoint-add-in
d9ab1da8000c-3
Pre-create and apply configuration Remote timer job based on user profile updates Each of the options have advantages and disadvantages in them and the right option depends on your detailed business requirements. Some of the settings you can also apply from the Office 365 suite level, but often you would be looki...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/onedrive-for-business-customization-sharepoint-add-in
d9ab1da8000c-4
Since by default Office 365 theme settings are for controlling OD4B site suite bar, you will most likely be using this options together with other options to ensure that you can provide at least the right branding elements cross your OD4B sites. Notice that when you change for example Office 365 theme settings in Offic...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/onedrive-for-business-customization-sharepoint-add-in
d9ab1da8000c-5
App part is hosting a page from provider hosted app, where in the server side code we initiate the customization process by adding needed metadata to the azure storage queue. This means that this page will only receive the customization request, but will not actually apply any changes to keep the processing time normal...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/onedrive-for-business-customization-sharepoint-add-in
d9ab1da8000c-6
Pre-create and apply configuration This option relies on the pre-creation of the OD4B sites before users will access them. This can be achieved by using relatively new API which provides us away to create OD4B sites for specific users in batch process, using either CSOM or REST. Needed code can be initiated using a...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/onedrive-for-business-customization-sharepoint-add-in
d9ab1da8000c-7
Actual sites are customized one-by-one based on the business requirements One of the key downsides of this option is that there can clearly be a situations where user can access the OD4B sites before the customizations have been applied. At the same time this option is interesting add-on for other options to ensure...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/onedrive-for-business-customization-sharepoint-add-in
d9ab1da8000c-8
Performance optimization and maintenance considerations Since this app part will be executed each time user lands to front page of the intranet, we need to consider the performance impact of this or how to make the code to work efficiently and only perform key parts of the code executions when truly needed. Second op...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/onedrive-for-business-customization-sharepoint-add-in
d9ab1da8000c-9
In this reference implementation we actually also refresh this file each time the WebJob is executed, which is certainly not needed, but sample code was meant to be working as easily without any additional steps and possible. Just as well you could upload the JavaScript file manually to root site collection and then re...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/onedrive-for-business-customization-sharepoint-add-in
d9ab1da8000c-10
Here’s the code which is used to generate the JavaScript URL for the user custom action. /// <summary> /// Just to build the JS path which can be then pointed to the OneDrive site. /// </summary> /// <returns></returns> public string BuildJavaScriptUrl(string siteUrl) { // Solve root site collection URL Uri u...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/onedrive-for-business-customization-sharepoint-add-in
d9ab1da8000c-11
Easiest way to ensure that our processing is not performed in each request is to use classic browser cookie approach, where we will store specific cookie to client browser with specific life time. By checking this cookie existence, we can skip the execution, until the cookie has been expired and that’s when we re-check...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/onedrive-for-business-customization-sharepoint-add-in
d9ab1da8000c-12
// Check if cookie exists in the current request. if (cookie == null) { // Create cookie. cookie = new HttpCookie("OneDriveCustomizerCheck"); // Set value of cookie to current date time. cookie.Value = DateTime.Now.ToString(); // Set cookie to expire in 60 minutes. ...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/onedrive-for-business-customization-sharepoint-add-in
d9ab1da8000c-13
return true; } } If you have a closer look on the code in the app part page, you’ll see that in every call we do check the existences of the OD4B site for the end user. Since this can be only done by accessing user profile, code will have impact on the performance. By using the above cookie check, we can make th...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/onedrive-for-business-customization-sharepoint-add-in
d9ab1da8000c-14
clientContext.Load(profile, prof => prof.AccountName); clientContext.Load(personalSite); clientContext.ExecuteQuery();
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/onedrive-for-business-customization-sharepoint-add-in
d9ab1da8000c-15
// Let's check if the site already exists if (personalSite.ServerObjectIsNull.Value) { Version customizations which are applied to OD4B site Second level of optimization on our code processing is done by versioning specifically the customizations which we deploy to the OD4B sites. What this means i...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/onedrive-for-business-customization-sharepoint-add-in
d9ab1da8000c-16
< SiteModificationManager.BrandingVersion) { When customization is applied to the site, we will set the applied customization version to the property bag for following execution. // Save current branding applied indicator to site ctx.Web.SetPropertyBagValue(SiteModificationManager.OneDriveMarkerBagID, SiteModifica...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/onedrive-for-business-customization-sharepoint-add-in
d9ab1da8000c-17
Reference solution structure This Visual Studio solution consists from quite a few solutions, but each of them have pretty reasonable reason to be there. Here’s introduction to each of the projects in the solution and why they exists or what they are for. OD4B.Configuration.Async This is the actual SharePoint a...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/onedrive-for-business-customization-sharepoint-add-in
d9ab1da8000c-18
OD4B.Configuration.Async.Console.Reset This project is our test and debugging project for the actual customizations. It can be used to manually apply the wanted customizations to any OD4B site. During development time this project was our testing project to test the customization process before it was hooked to the W...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/onedrive-for-business-customization-sharepoint-add-in
d9ab1da8000c-19
OD4B.Configuration.Async.Console.SendMessage This project was added to the solution to test the storage queue mechanism before it was hooked to the app part. Project can be used to by pass the app part process for adding new messages to the storage queue. Notice that you will need to update the storage queue connecti...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/onedrive-for-business-customization-sharepoint-add-in
d9ab1da8000c-20
// running continuously host.RunAndBlock(); } } Actual queue processing is really easy with WebJobs. Only thing we need to do is to set the right attributes for the method and to ensure that the Azure storage connection strings in the app config are updated accordingly and matching the storage queue’s yo...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/onedrive-for-business-customization-sharepoint-add-in
d9ab1da8000c-21
using (var ctx = TokenHelper.GetClientContextWithAccessToken( url.ToString(), token)) { // Set configuration object properly for setting the config SiteModificationConfig config = new SiteModificationConfig() { SiteUrl = url.ToString(), JSFile = Path.Combine(E...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/onedrive-for-business-customization-sharepoint-add-in
d9ab1da8000c-22
new SiteModificationManager().ApplySiteConfiguration(ctx, config); } } Other thing worth noticing is that you will need to ensure that you have set the Copy Local property for the SharePoint CSOM assembly references property for the project, so that all dependent assemblies are properly copied to Azure when yo...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/onedrive-for-business-customization-sharepoint-add-in
d9ab1da8000c-23
string account, string siteUrl, string storageConnectionString) { CloudStorageAccount storageAccount = CloudStorageAccount.Parse(storageConnectionString); // Get queue... create if does not exist. CloudQueueClient queueClient = storageAccount.CreateCloudQueueClient(); CloudQu...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/onedrive-for-business-customization-sharepoint-add-in
d9ab1da8000c-24
// Pass in data for modification var newSiteConfigRequest = new SiteModificationData() { AccountId = account, SiteUrl = siteUrl };
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/onedrive-for-business-customization-sharepoint-add-in
d9ab1da8000c-25
// Add entry to queue queue.AddMessage( new CloudQueueMessage( JsonConvert.SerializeObject(newSiteConfigRequest))); } Actual queue processing in this case was done with the WebJob project. In the case of WebJob, we can simply use specific attributes to automate the queue handling. Only thing ...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/onedrive-for-business-customization-sharepoint-add-in
d9ab1da8000c-26
Second operation with the custom themes require that we upload some additional files to the site and then set those to be used as theme settings. We do use strictly CSOM to upload all needed files to the sites to avoid any future complications with feature framework element associations. Since uploading a file to the S...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/onedrive-for-business-customization-sharepoint-add-in
d9ab1da8000c-27
using (var ctx = TokenHelper.GetClientContextWithAccessToken( url.ToString(), token)) { // Set configuration object properly for setting the config SiteModificationConfig config = new SiteModificationConfig() { SiteUrl = url.ToString(), JSFile = Path.Combine(E...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/onedrive-for-business-customization-sharepoint-add-in
d9ab1da8000c-28
new SiteModificationManager().ApplySiteConfiguration(ctx, config); } } Obviously the needed operations are highly dependent on your business requirements. You can find multiple different patterns and approaches with CSOM based operations from the Office 365 Developer Patterns and Practices . Additional notes ...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/onedrive-for-business-customization-sharepoint-add-in
d9ab1da8000c-29
One of the great improvements from the debugging perspective for the WebJobs was introduced in the Visual Studio 2014 Update 4. With the newly introduced Azure connections and project templates, you can actually do remote debugging with WebJob running in the Azure side. You will need to deploy the WebJob to the Azure a...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/onedrive-for-business-customization-sharepoint-add-in
d9ab1da8000c-30
string.Format("~/{0}", "Resources/OneDriveConfiguration.js")); Since WebJobs are however executed in different location and not in the context of IIS, above reference to file would not work, since mapping would fail from the context of the WebJob process. This is where WebJob specific environment variables can help....
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/onedrive-for-business-customization-sharepoint-add-in
d9ab1da8000c-31
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/onedrive-for-business-customization-sharepoint-add-in
b198864c6844-0
The approach you take to deploy artifacts to a SharePoint environment 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, modules defined in declarative code (feature framework XML files) were added to SharePoint features. The mo...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/modules-sharepoint-add-in
b198864c6844-1
This sample demonstrates how to create a new folders in the Style Library and add JavaScript files and images to the new files. Branding.ClientSideRendering (O365 PnP Code Sample) See the UploadJSFiles and the UploadFileToFolder methods in the Default.aspx.cs class for more details. These methods are ...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/modules-sharepoint-add-in
b198864c6844-2
if (samplesJSfolder != null) { samplesJSfolder.DeleteObject(); web.Context.ExecuteQuery(); } //Create new folder samplesJSfolder = list.RootFolder.Folders.Add("JSLink-Samples"); web.Context.Load(samplesJSfolder); web.Context.ExecuteQuery(); //Upload JavaScript files to fold...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/modules-sharepoint-add-in
b198864c6844-3
//Upload image files to folder UploadFileToFolder(web, Server.MapPath("../Scripts/JSLink-Samples/imgs/Confidential.png"), imgsFolder); } Create a folder and upload image files to the folder: public static void UploadFileToFolder(Web web, string filePath, Folder folder) { //Create a FileStream to the file to ...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/modules-sharepoint-add-in
b198864c6844-4
folder.Context.Load(uploadFile); folder.Context.ExecuteQuery(); } } This sample demonstrates how to upload master pages, set master page meta data and apply the master page to the site by setting the CustomMasterUrl property on the Web object. Branding.ApplyBranding (O365 PnP Code Sampl...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/modules-sharepoint-add-in
b198864c6844-5
//set master pages back to the defaults that were being used if (web.AllProperties.FieldValues.ContainsKey("OriginalMasterUrl")) { web.MasterUrl = (string)web.AllProperties["OriginalMasterUrl"]; } if (web.AllProperties.FieldValues.ContainsKey("CustomMasterUrl")) { web.CustomMasterUrl...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/modules-sharepoint-add-in
b198864c6844-6
DeleteFile(web, name, masterPath, folder); } Watch the Applying Branding to SharePoint Sites with an Add-in for SharePoint (Office 365 PnP Video) for a walk through of this sample. This sample has a little of everything in it. It demonstrates how to activate the publishing features, upload page layout...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/modules-sharepoint-add-in
b198864c6844-7
FeatureCollection clientWebFeatures = ctx.Web.Features; ctx.Load(clientWebFeatures); //Activate the web feature clientWebFeatures.Add(publishingWebFeatureId, true, FeatureDefinitionScope.Farm); ctx.ExecuteQuery(); } Create a list: public static List CreateList(ClientContext ctx, int templateType, ...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/modules-sharepoint-add-in
b198864c6844-8
return ct; } Upload a page layout public static void UploadPageLayout(ClientContext ctx, string sourcePath, string targetListTitle, string targetUrl) { using (FileStream fs = new FileStream(sourcePath, FileMode.Open, FileAccess.Read)) { byte[] data = new byte[fs.Length]; fs.Read(data, 0, data.Lengt...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/modules-sharepoint-add-in
b198864c6844-9
Microsoft.SharePoint.Client.File file = web.GetFileByServerRelativeUrl(pages.RootFolder.ServerRelativeUrl + "/" + pageName + ".aspx"); clientContext.Load(file, f => f.Exists); clientContext.ExecuteQuery(); if(file.Exists) { file.DeleteObject(); clientContext.ExecuteQuery(); }...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/modules-sharepoint-add-in
b198864c6844-10
PublishingPage publishingPage = publishingWeb.AddPublishingPage(publishingpageInfo); publishingPage.ListItem.File.CheckIn(string.Empty, CheckinType.MajorCheckIn); publishingPage.ListItem.File.Publish(string.Empty); clientContext.ExecuteQuery(); } SetSupportCaseContent(clientContext, "Sup...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/modules-sharepoint-add-in
b198864c6844-11
string quicklaunchmenuFormat = @"<div><a href='{0}/{1}'>Sample Home Page</a></div> <br /> <div style='font-weight:bold'>CSR Dashboard</div> <div class='cdsm_mainmenu'> <ul> <li><a href='{0}/CSRInfo/{1}'>My CSR Info</a></li> <li><a href='{0}/Cal...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/modules-sharepoint-add-in
b198864c6844-12
string quicklaunchmenu = string.Format(quicklaunchmenuFormat, url, queryurl); string qlwebPartXml = "<?xml version=\"1.0\" encoding=\"utf-8\"?><webParts><webPart xmlns=\"http://schemas.microsoft.com/WebPart/v3\"><metaData><type name=\"Microsoft.SharePoint.WebPartPages.ScriptEditorWebPart, Microsoft.SharePoint, Ver...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/modules-sharepoint-add-in
b198864c6844-13
//Support Case CBS Info web part string cbsInfoWebPartXml = System.IO.File.ReadAllText(System.Web.Hosting.HostingEnvironment.ApplicationPhysicalPath + "Assets/SupportCaseCBSWebPartInfo.webpart"); WebPartDefinition cbsInfoWpd = limitedWebPartManager.ImportWebPart(cbsInfoWebPartXml); WebPartDefinition cbsInfo...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/modules-sharepoint-add-in
b198864c6844-14
//Get Host Web Query String and show support case list web part string querywebPartXml = System.IO.File.ReadAllText(System.Web.Hosting.HostingEnvironment.ApplicationPhysicalPath + "Assets/GetHostWebQueryStringAndShowList.webpart"); WebPartDefinition queryWpd = limitedWebPartManager.ImportWebPart(querywebPartXml...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/modules-sharepoint-add-in
b198864c6844-15
file.CheckIn("Data storage model", CheckinType.MajorCheckIn); file.Publish("Data storage model"); ctx.Load(file); ctx.ExecuteQuery(); } See the FillHostWebSupportCasesToThreshold and the FillAppWebNotesListToThreshold methods in the SharePointService.cs class for more details about deploying list...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/modules-sharepoint-add-in
b198864c6844-16
if(supportCasesList.ItemCount>=5000) return "The Host Web Support Cases List has " + supportCasesList.ItemCount + " items, and exceeds the threshold."; else return 500 + " items have been added to the Host Web Support Cases List. " + "There are " + (5000 - supportCasesList.ItemCoun...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/modules-sharepoint-add-in
b198864c6844-17
if (notesList.ItemCount >= 5000) return "The Add-in Web Notes List has " + notesList.ItemCount + " items, and exceeds the threshold."; else return 500 + " items have been added to the Add-in Web Notes List. " + "There are " + (5000-notesList.ItemCount) + " ite...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/modules-sharepoint-add-in
174988a853d7-0
The approach you take to perform Create, Read, Update and Delete (CRUD) operations in the Managed Metadata Service (MMS) 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, MMS CRUD operations were performed with the SharePoint s...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/mms-manipulation-sharepoint-add-in
174988a853d7-1
When is it a good fit? When you have an on-premises SharePoint environment and you are performing a one-way copy of terms, this is a good option because it may be implemented quickly and easily without writing any code. On-premises & O365 - Use CSOM to copy data If you have an on-premises or Office 365 SharePoint...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/mms-manipulation-sharepoint-add-in
174988a853d7-2
Related links SharePoint 2013: Synchronize term sets with the term store (CSOM) Guidance articles at https://aka.ms/OfficeDevPnPGuidance References in MSDN at https://aka.ms/OfficeDevPnPMSDN Videos at https://aka.ms/OfficeDevPnPVideos PnP samples Core.MMS (O365 PnP Sample) Core.MMSSync (O365 PnP ...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/mms-manipulation-sharepoint-add-in
26e9f414106e-0
The approach you take to implement custom master pages in 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 are created to implement a custom brand. The master page...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/master-pages-sharepoint-add-in
26e9f414106e-1
Team sites vs. publishing sites When is a custom master page needed? When applying custom branding to SharePoint sites, you will encounter the need to brand both team sites and publishing sites. Generally speaking, intranets built on SharePoint in both on-premises and Office 365 scenarios use a combination of team ...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/master-pages-sharepoint-add-in
26e9f414106e-2
See the Modules (SharePoint Add-in Recipe) and Site Provisioning (SharePoint Add-in Recipe) for more deployment details and additional samples. More details about custom master pages and page layouts for SharePoint sites In scenarios where a custom master page is the only way to implement your custom branding...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/master-pages-sharepoint-add-in
26e9f414106e-3
Custom master pages may be uploaded manually via the web browser and manually assigned to composed looks. Custom master pages may be uploaded and assigned to a SharePoint site via the remote provisioning pattern as well. See the Modules (SharePoint Add-in Recipe) and Site Provisioning (SharePoint Add-in Recipe)...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/master-pages-sharepoint-add-in
209877e5ad36-0
The approach you take to implement localization for Add-ins 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, localization for custom components such as web parts, User Controls, and Web Controls was implemented with a combinat...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/localization-sharepoint-add-in
209877e5ad36-1
When is it a good fit? When you are creating a SharePoint-hosted Add-in, using JavaScript is your best fit because you can implement localization with JavaScript and deploy all of the JavaScript files necessary to support localization with the SharePoint-hosted Add-in. You can also take advantage of this approach if ...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/localization-sharepoint-add-in
209877e5ad36-2
Related links Localize SharePoint Add-ins (MSDN Article) Localize the add-in web, host web, and remote components of an add-in (Office Dev GitHub sample) Guidance articles at https://aka.ms/OfficeDevPnPGuidance References in MSDN at https://aka.ms/OfficeDevPnPMSDN Videos at https://aka.ms/OfficeDevPnPVi...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/localization-sharepoint-add-in
dbe8e9f76f15-0
The approach you take to create list instances 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 instances were created with declarative code and deployed via SharePoint Solutions. In a SharePoint Add-in model scenario, ...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/list-instance-sharepoint-add-in
dbe8e9f76f15-1
//Turn on versioning if(library.VerisioningEnabled) { _list.EnableVersioning = true; } //Turn on Content Types _list.ContentTypesEnabled = true; _list.Update(); //Add Content Type to List ctx.Web.AddContentTypeToListById(library.Title, associateContentTypeID...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/list-instance-sharepoint-add-in
dbe8e9f76f15-2
ctx.Web.Context.ExecuteQuery(); } } The following code sample illustrates how to create a list instance with the SharePoint REST API. This sample comes from the Lists and list items REST API reference (MSDN Article) executor.executeAsync({ url: "<app web url>/_api/SP.AppContextSite(@target)/web/lists ?...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/list-instance-sharepoint-add-in
881eb5c4e3b7-0
The approach you take to create list definitions / list templates 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 list definitions / list templates were created with declarative code and deployed via SharePoint Soluti...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/list-definition-template-sharepoint-add-in
881eb5c4e3b7-1
This approach allows you to apply standardized settings for all lists. This approach allows you to apply standardized settings to different types of lists. For example: If you create a document library and a tasks list you can determine in the ListAdded event receiver which type of list you created and you can app...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/list-definition-template-sharepoint-add-in
881eb5c4e3b7-2
Create a SharePoint Add-in In this pattern you create a SharePoint Add-in to create lists with standardized settings and instruct your users to use the SharePoint Add-in to create new lists. Essentially, the SharePoint Add-in provides users with choices of different lists to create. The different lists the SharePoi...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/list-definition-template-sharepoint-add-in
881eb5c4e3b7-3
References in MSDN at https://aka.ms/OfficeDevPnPMSDN Videos at https://aka.ms/OfficeDevPnPVideos PnP samples ECM.DocumentLibraries (O365 PnP Code Sample) Samples and content at https://github.com/SharePoint/PnP Applies to Office 365 Multi Tenant (MT) Office 365 Dedicated (D) partly SharePoi...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/list-definition-template-sharepoint-add-in
d5337057758e-0
You can use namespaces to avoid conflicts between your JavaScript customizations and standard SharePoint JavaScript or JavaScript customizations deployed by other developers. The OfficeDev/PnP samples and solutions often include JavaScript code. In order to make the techniques easy to understand, these samples are ...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/embedding-javascript-into-sharepoint
d5337057758e-1
MySolution.MyClass1.myFunction2(); Because all your code uses the custom MySolution namespace, you can avoid any naming conflicts. Namespaces and Minimal Download Strategy (MDS) With the Minimal Download Strategy Feature enabled, Global Namespaces and Variables are cleared on MDS navigation. To retain your ...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/embedding-javascript-into-sharepoint
8ac5c4dc9d00-0
The approach you take to apply information management policy 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, information management policy was managed and applied via the SharePoint Server Side Object Model and deployed via ...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/information-management-policy-sharepoint-add-in
8ac5c4dc9d00-1
Getting Started The following O365 PnP Code Sample and video demonstrates how to manage and apply information management policy for SharePoint sites. In this example, the code iterates through the content types applied to document libraries in SharePoint site collections and applies a retention policy. Governanc...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/information-management-policy-sharepoint-add-in
b52fa502aa7c-0
The approach you take to run code and deploy artifacts when a SharePoint site is provisioned 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, out-of-the-box site definitions were modified with stapled features. Features were...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/feature-stapling-sharepoint-add-in
b52fa502aa7c-1
Staple features Staple Add-ins Use the remote provisioning pattern Staple features In this pattern you staple features to site definitions. This pattern is only available at the site collection level. It is not possible to staple features to sub sites. This is not an optimal or recommended approach be...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/feature-stapling-sharepoint-add-in
b52fa502aa7c-2
This can make it difficult to use the Add-in stapling pattern to automatically apply changes to sites where it is deployed because these events do not fire when it is deployed to sites. Add-in parts are not supported when Add-ins are stapled to sites. This pattern requires manual user actions to deploy the Add-...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/feature-stapling-sharepoint-add-in
b52fa502aa7c-3
//Load and Install the Add-in on the subweb AppInstance appInstance = subweb.LoadAndInstallApp(fsSource); ctx.Load(appInstance); ctx.ExecuteQuery(); } Watch the Creating Cloud Hosted Line Of Business Applications with Add-ins for Office, O365, Azure, and WP8 (Todd Baginski, Michael Sherman - S...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/feature-stapling-sharepoint-add-in
fe5e7fa6a149-0
The approach you take to handle events 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, Event Receivers and List Event Receivers were created with the SharePoint Server Side Object Model code and deployed via...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/event-receiver-and-list-event-receiver-sharepoint-add-in
fe5e7fa6a149-1
Event receivers added to host web without app context, for example with SharePointOnlineCredentials or other means, will not return access token and you'll have to access the host web with app-only access token Adding event receivers to the host web is supported. It is only possible to do this via CSOM/REST APIs, ...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/event-receiver-and-list-event-receiver-sharepoint-add-in
fe5e7fa6a149-2
Debugging Event Receivers To debug event receivers you need to configure a few different things in Azure and Visual Studio. The following article provide step by step instructions and more information related to debugging. Debug and troubleshoot a remote event receiver in an add-in for SharePoint MSDN Blog Post)...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/event-receiver-and-list-event-receiver-sharepoint-add-in
fe5e7fa6a149-3
Create a remote event receiver in add-ins for SharePoint (MSDN Article) Create an app event receiver in SharePoint 2013 (MSDN Article) Guidance articles at https://aka.ms/OfficeDevPnPGuidance References in MSDN at https://aka.ms/OfficeDevPnPMSDN Videos at https://aka.ms/OfficeDevPnPVideos PnP samples ...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/event-receiver-and-list-event-receiver-sharepoint-add-in
aeb5b9dc6eda-0
The approach you take to set unique identifiers for documents 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 event handlers running SharePoint Server-side Object Model code were used to set unique ide...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/document-id-provider-sharepoint-add-in