id
stringlengths
14
16
text
stringlengths
2
3.14k
source
stringlengths
45
175
57918492400f-8
// Add the custom action to the site. cc.Web.AddCustomAction(customAction); The AddCustomAction method adds the custom action to the UserCustomActions collection that is associated with the SharePoint site. var newAction = existingActions.Add(); newAction.Description = customAction.Description; ...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/customize-the-ux-by-using-sharepoint-provider-hosted-add-ins
57918492400f-9
scriptEditorWp.WebPartIndex = 1; scriptEditorWp.WebPartTitle = "Script editor test"; cc.Web.AddWebPartToWikiPage("SitePages", scriptEditorWp, scenario1Page, 1, 1, false); The AddWikiPage method loads the site pages library. If the wiki page specified by the add-in OfficeDevPnP Core doesn't already exist, it cr...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/customize-the-ux-by-using-sharepoint-provider-hosted-add-ins
57918492400f-10
var pageLibrary = web.Lists.GetByTitle(wikiPageLibraryName); web.Context.Load(pageLibrary.RootFolder, f => f.ServerRelativeUrl); web.Context.ExecuteQuery(); var pageLibraryUrl = pageLibrary.RootFolder.ServerRelativeUrl; var newWikiPageUrl = pageLibraryUrl + "/" + wikiPa...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/customize-the-ux-by-using-sharepoint-provider-hosted-add-ins
57918492400f-11
context.executeQueryAsync( Function.createDelegate(this, successHandler), Function.createDelegate(this, errorHandler) ); https://github.com/SharePoint/PnP/tree/dev/Samples/Core.AppScriptPart Personalized UI elements The Branding.UIElementPersonalization sample shows how to u...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/customize-the-ux-by-using-sharepoint-provider-hosted-add-ins
57918492400f-12
var actions = existingActions.ToArray(); foreach (var action in actions) { if (action.Description == "personalize" && action.Location == "ScriptLink") { action.DeleteObject(); ctx.ExecuteQuery(); ...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/customize-the-ux-by-using-sharepoint-provider-hosted-add-ins
57918492400f-13
// Load jQuery. loadScript(jQuery, function () { personalizeIt(); }); } The personalizeIt() function checks HTML5 local storage before it looks up user profile information. If it goes to user profile information, it stores the information that it retrieves in HTML5 local storage. function per...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/customize-the-ux-by-using-sharepoint-provider-hosted-add-ins
57918492400f-14
// Load image or make sure it is current based on the value in AboutMe. if (!personalized) { loadPersonalizedImage(buCode); } }, 'SP.UserProfiles.js'); } The personalize.js file also contains code that checks to determine whether the local storage key has expired. This isn't built...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/customize-the-ux-by-using-sharepoint-provider-hosted-add-ins
57918492400f-15
if (currentTime - parseInt(expiryStamp) > parseInt(cacheTimeout)) { return true; //Expired } else { return false; } } else { //default return true; } } Client-side rendering The Branding.ClientSideRendering sample shows how to use a ...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/customize-the-ux-by-using-sharepoint-provider-hosted-add-ins
57918492400f-16
flciNewFile.ContentStream = fs; flciNewFile.Url = System.IO.Path.GetFileName(filePath); flciNewFile.Overwrite = true; Microsoft.SharePoint.Client.File uploadFile = folder.Files.Add(flciNewFile); uploadFile.CheckIn("CSR sample js file", CheckinType.MajorCh...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/customize-the-ux-by-using-sharepoint-provider-hosted-add-ins
57918492400f-17
var priority = ctx.CurrentItem[ctx.CurrentFieldSchema.Name]; // Return HTML element with appropriate color based on the Priority column's value. switch (priority) { case "(1) High": return "<span style='color :#f00'>" + priority + "</span>"; break; case "(2) Normal": ...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/customize-the-ux-by-using-sharepoint-provider-hosted-add-ins
57918492400f-18
} Sample 3: Display an image with a document name Sample 3 shows you how to display an image next to a document name inside a document library. A red badge appears whenever the Confidential field value is set to Yes . Image display next to document name The following JavaScript checks the Confidential f...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/customize-the-ux-by-using-sharepoint-provider-hosted-add-ins
57918492400f-19
// Check confidential field value. if (confidential &amp;&amp; confidential.toLowerCase() == 'yes') { // Render HTML that contains the file name and the confidential icon. return title + "&amp;nbsp;<img src= '" + _spPageContextInfo.siteServerRelativeUrl + "/Style%20Library/JSLink-Samples/imgs/Confid...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/customize-the-ux-by-using-sharepoint-provider-hosted-add-ins
57918492400f-20
var formCtx = SPClientTemplates.Utility.GetFormContextForCurrentField(ctx); // Register a callback just before submit. formCtx.registerGetValueCallback(formCtx.fieldName, function () { return document.getElementById('inpPercentComplete').value; }); return "<input type='range' id='inpPercentCom...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/customize-the-ux-by-using-sharepoint-provider-hosted-add-ins
57918492400f-21
// Be careful when adding the header for the template, because it will break the default list view render. accordionContext.Templates.Header = "<div class='accordion'>"; accordionContext.Templates.Footer = "</div>"; // Add OnPostRender event handler to add accordion click events and style. accordionCon...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/customize-the-ux-by-using-sharepoint-provider-hosted-add-ins
57918492400f-22
$('.accordion h2').css('cursor', 'pointer'); } Sample 6: Validate field values Sample 6 shows you how to use regular expressions to validate field values supplied by the user. A red error message appears when the user types an invalid email address into the Email field text box. This happens when the user either...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/customize-the-ux-by-using-sharepoint-provider-hosted-add-ins
57918492400f-23
if (!emailRejex.test(value) &amp;&amp; value.trim()) { isError = true; errorMessage = "Invalid email address"; } // Send error message to error callback function (emailOnError). return new SPClientForms.ClientValidation.ValidationResult(isError, errorMessage); }; }; // Add error message to s...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/customize-the-ux-by-using-sharepoint-provider-hosted-add-ins
57918492400f-24
case "URL": return RenderFieldValueDefault(ctx); case "User": prepareUserFieldValue(ctx); return SPFieldUser_Display(ctx); case "UserMulti": prepareUserFieldValue(ctx); return SPFieldUserMulti_Display(ctx); case "DateTime": return SPFieldDateTime_Display(ctx); cas...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/customize-the-ux-by-using-sharepoint-provider-hosted-add-ins
57918492400f-25
ctx["CurrentFieldValue"] = fieldValue; } } // Note control needs specific formatted value to render content correctly. function prepareNoteFieldValue(ctx) { if (ctx["CurrentFieldValue"]) { var fieldValue = ctx["CurrentFieldValue"]; fieldValue = "<div>" + fieldValue.replace(/\n/g, '<br />'); + "</div>"; ...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/customize-the-ux-by-using-sharepoint-provider-hosted-add-ins
57918492400f-26
SPClientTemplates.TemplateManager.RegisterTemplateOverrides(hiddenFiledContext); })(); // This function provides the rendering logic. function hiddenFiledTemplate() { return "<span class='csrHiddenField'></span>"; } // This function provides the rendering logic. function hiddenFiledOnPreRender(ctx) { jQuery(".cs...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/customize-the-ux-by-using-sharepoint-provider-hosted-add-ins
57918492400f-27
// Upload the OneDrive for Business Usage Guidelines.docx. using (var stream = System.IO.File.OpenRead(Server.MapPath("~/userprofileinformation.webpart"))) { FileCreationInformation fileInfo = new FileCreationInformation(); fileInfo.ContentStream = stream; fileInfo.Overwrite = true; fileInfo.Url = "...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/customize-the-ux-by-using-sharepoint-provider-hosted-add-ins
57918492400f-28
lblStatus.Text = string.Format("add-in script part has been added to Web Part Gallery. You can find 'User Profile Information' script part under 'Add-in Script Part' group in the <a href='{0}'>host web</a>.", spContext.SPHostUrl.ToString()); } After you finish this step, you can locate the User profile information ...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/customize-the-ux-by-using-sharepoint-provider-hosted-add-ins
57918492400f-29
var html = "<div><h2>Welcome " + firstname + "</h2></div><div><div style='float: left; margin-left:10px'><img style='float:left;margin-right:10px' src='" + picture + "' /><b>Name</b>: " + name + "<br /><b>Title</b>: " + title + "<br />" + aboutMe + "</div></div>";
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/customize-the-ux-by-using-sharepoint-provider-hosted-add-ins
57918492400f-30
document.getElementById('UserProfileAboutMe').innerHTML = html; }), Function.createDelegate(this, function (sender, args) { console.log('The following error has occurred while loading user profile property: ' + args.get_message()); })); }, 'SP.UserProfiles.js'); } Provisioning publishing features T...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/customize-the-ux-by-using-sharepoint-provider-hosted-add-ins
57918492400f-31
The sample displays this user's information on the page. It also adds a page, although in this case it uses a PublishingPageInformation object to create the new page. The sample adds a new page layout by uploading a file to the Master Page Gallery and assigning it the page layout content type. The following code ta...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/customize-the-ux-by-using-sharepoint-provider-hosted-add-ins
57918492400f-32
var fileBytes = System.IO.File.ReadAllBytes(sourceFilePath); // Use CSOM to upload the file. FileCreationInformation newFile = new FileCreationInformation(); newFile.Content = fileBytes; newFile.Url = UrlUtility.Combine(rootFolder.ServerRelativeUrl, fileName); newFile.Overwrite = true; Microsoft.SharePoint.Client.Fil...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/customize-the-ux-by-using-sharepoint-provider-hosted-add-ins
57918492400f-33
// Check in the page layout if needed. if (masterPageGallery.ForceCheckout || masterPageGallery.EnableVersioning) { uploadFile.CheckIn(string.Empty, CheckinType.MajorCheckIn); listItem.File.Publish(string.Empty); } web.Context.ExecuteQuery(); You can verify that your new page is using the new page layout by goin...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/customize-the-ux-by-using-sharepoint-provider-hosted-add-ins
57918492400f-34
Microsoft.SharePoint.Client.File uploadFile = rootFolder.Files.Add(newFile); web.Context.Load(uploadFile); web.Context.ExecuteQuery(); var listItem = uploadFile.ListItemAllFields; if (masterPageGallery.ForceCheckout || masterPageGallery.EnableVersioning) { if (uploadFile.CheckOutType == CheckOutType.None) { u...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/customize-the-ux-by-using-sharepoint-provider-hosted-add-ins
57918492400f-35
listItem["Title"] = title; listItem["MasterPageDescription"] = description; // Set content type as master page. listItem["ContentTypeId"] = Constants.MASTERPAGE_CONTENT_TYPE; listItem["UIVersion"] = uiVersion; listItem.Update(); if (masterPageGallery.ForceCheckout || masterPageGallery.EnableVersioning) { uploadFile.C...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/customize-the-ux-by-using-sharepoint-provider-hosted-add-ins
57918492400f-36
item["Name"] = themeName; item["Title"] = themeName; if (!string.IsNullOrEmpty(colorFileName)) { item["ThemeUrl"] = UrlUtility.Combine(rootWeb.ServerRelativeUrl, string.Format(Constants.THEMES_DIRECTORY, Path.GetFileName(colorFileName))); } if (!string.IsNullOrEmpty(fontFileName)) { item["FontSchemeUrl"] = UrlUtili...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/customize-the-ux-by-using-sharepoint-provider-hosted-add-ins
57918492400f-37
// set the properties for applying the custom theme that was just uploaded. string spColorURL = null; if (themeEntry["ThemeUrl"] != null &amp;&amp; themeEntry["ThemeUrl"].ToString().Length > 0) { spColorURL = UrlUtility.MakeRelativeUrl((themeEntry["ThemeUrl"] as FieldUrlValue).Url); } string spFontURL = n...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/customize-the-ux-by-using-sharepoint-provider-hosted-add-ins
57918492400f-38
// Set theme for demonstration. // TODO: Why is shareGenerated false? If deploying to root and inheriting, maybe use shareGenerated = true. web.ApplyTheme(spColorURL, spFontURL, backGroundImage, false); web.Context.ExecuteQuery(); Scenario 3: Fi...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/customize-the-ux-by-using-sharepoint-provider-hosted-add-ins
57918492400f-39
// Set default page layout for the site. clientContext.Web.SetDefaultPageLayoutForSite(clientContext.Web, "ContosoLinksBelow.aspx"); The sample sets the available site templates by doing something similar. In this case, it passes the WebTemplateEntity instances that define each site template to an extension method...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/customize-the-ux-by-using-sharepoint-provider-hosted-add-ins
57918492400f-40
if (availableTemplates.Count > 0) { XmlDocument xd = new XmlDocument(); XmlNode xmlNode = xd.CreateElement("webtemplates"); xd.AppendChild(xmlNode); foreach (var language in languages) { XmlNode xmlLcidNode = xmlNode.AppendChild(xd.CreateElement("lcid")); XmlAttribute xmlAttribute = xd...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/customize-the-ux-by-using-sharepoint-provider-hosted-add-ins
83ec6d255351-0
Use provider-hosted SharePoint Add-ins to control user experience (UX) components in SharePoint and SharePoint Online. Article Shows you how to... Customize the UX by using SharePoint provider-hosted add-ins Use provider-hosted add-ins that create and modify SharePoint pages, layouts, and other ...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/ux-components-in-sharepoint-2013-and-sharepoint-online
b16cf8da4dc2-0
This article shows you how to add or remove groups and users within a given site collection. The code examples in this article add users and groups, and then give them permission levels of access to SharePoint. These user and group permission level actions are implemented via extension methods in the Core.GroupManagem...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/manage-sharepoint-users-and-groups
b16cf8da4dc2-1
if (!cc.Web.GroupExists("Test")) { Group group = cc.Web.AddGroup("Test", "Test group", true); cc.Web.AddUserToGroup("Test", currentUser.LoginName); } The next example removes a group. if (cc.Web.GroupExists("Test")) { cc.Web.RemoveGroup("Test"); } The next example removes users from groups. cc.Load(...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/manage-sharepoint-users-and-groups
3a260225999d-0
You can use the Core.SitePermissions sample to modify the site collection administrators on any site collection, including those for OneDrive for Business on Office 365 tenants. This sample also shows you how to obtain external sharing status for Office 365 Multi-Tenant installations. Using a console application, y...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/modify-sharepoint-site-permissions-and-get-external-sharing-status
3a260225999d-1
UserEntity adminToRemove = new UserEntity() { LoginName = "i:0#.f|membership|user@domain" }; cc.Web.RemoveAdministrator(adminToRemove); You can set the site collection administrators for site collections where you're not already a site collection administrator by creating a ClientContext object using a registere...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/modify-sharepoint-site-permissions-and-get-external-sharing-status
3a260225999d-2
ClientContext cc = new AuthenticationManager().GetAppOnlyAuthenticatedContext("https://tenantname-my.sharepoint.com/personal/user2", "<your tenant realm>", "<appID>", "<appsecret>"); Work with external sharing (Office 365 MT only) This scenario shows how to get the external sharing status of a site collection, and...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/modify-sharepoint-site-permissions-and-get-external-sharing-status
3a260225999d-3
List<ExternalUserEntity> externalUsers = ccTenant.Web.GetExternalUsersForSiteTenant(new Uri(String.Format("https://{0}.sharepoint.com/sites/{1}", tenantName, siteName))); List<ExternalUserEntity> externalUsers = ccTenant.Web.GetExternalUsersTenant(); See also Provisioning.Pages sample SharePoint site provisi...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/modify-sharepoint-site-permissions-and-get-external-sharing-status
f6d5a8b4dccc-0
You can use the Core.SPD sample to programmatically create site columns and content types and link them together. You can also use the SharePoint CSOM APIs, available in the SharePoint Server 2013 Client Components SDK , to add a specific content type identifier, and localize content types, lists, and site titles....
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/create-sharepoint-content-types-by-using-csom
f6d5a8b4dccc-1
Using AddFieldAsXml you can add fields to the FieldCollection of a site collection: FieldCollection fields = web.Fields; cc.Load(fields); cc.ExecuteQuery(); string FieldAsXML = @"<Field ID='{4F34B2ED-9CFF-4900-B091-4C0033F89944}' Name='ContosoString' DisplayName='Contoso String' Type='Text' Hidden='False' Group='Conto...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/create-sharepoint-content-types-by-using-csom
f6d5a8b4dccc-2
For a list, you use the same approach as for a site. list.TitleResource.SetValueForUICulture("fi-FI", "Kielikäännä minut"); list.DescriptionResource.SetValueForUICulture("fi-FI", "Tämä esimerkki näyttää miten voit kielikääntää listoja."); For content types, you have the option to localize the name a...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/create-sharepoint-content-types-by-using-csom
f6d5a8b4dccc-3
string path = @"C:\Data\Test Documents\Doc CT File.docx"; string fileName = System.IO.Path.GetFileName(path); byte[] filecontent = System.IO.File.ReadAllBytes(path); using (System.IO.FileStream fs = new System.IO.FileStream(path, System.IO.FileMode.Open)) { ...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/create-sharepoint-content-types-by-using-csom
d59478fda4a7-0
When you create a new list in the host web, you can use a ListAdded remote event receiver to modify that list. For example, you can enable versioning, or add a content type to the list, or make any other changes implemented by the client object model (CSOM). When the list is added to the host web, you need to progr...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/modify-sharepoint-host-web-lists-at-creation-time
d59478fda4a7-1
// Get WCF URL where this message was handled. OperationContext op = OperationContext.Current; Message msg = op.RequestContext.RequestMessage; receiver.ReceiverUrl = msg.Headers.To.ToString(); receiver.ReceiverName = RECEIVER_NAME; receiver.Synchronization = EventReceiverSynchronization.Synchronous; cc.Web....
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/modify-sharepoint-host-web-lists-at-creation-time
7f6ace411b7f-0
Note For SharePoint Online site classification, see SharePoint "modern" sites classification . Even with good governance, SharePoint sites can proliferate and grow out of control. Sites are created as they are needed, but are rarely deleted. Search crawl is burdened by unused site collections, and search produce...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/implement-a-sharepoint-site-classification-solution
7f6ace411b7f-1
Description: This is super secret. Set radio button Delete sites automatically . For Deletion Event: , use Site created date + 1 year. Select the Send an email notification to site owners this far in advance of deletion: check box, and set it to 1 month. Select the Send follow-up notifications eve...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/implement-a-sharepoint-site-classification-solution
7f6ace411b7f-2
static void AddCustomAction(ClientContext ctx, string hostUrl) { var _web = ctx.Web; ctx.Load(_web); ctx.ExecuteQuery(); // You only want the action to show up if you have manage web permissions. BasePermissions _manageWebPermission = new BasePermissions(); _manageWebPermission.Set(PermissionKi...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/implement-a-sharepoint-site-classification-solution
7f6ace411b7f-3
CustomActionEntity _siteActionSC = new CustomActionEntity() { Group = "SiteActions", Location = "Microsoft.SharePoint.StandardMenu", Title = "Site Classification", Sequence = 1000, Url = string.Format(hostUrl, ctx.Url), Rights = _manageWebPermission }; _web.Ad...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/implement-a-sharepoint-site-classification-solution
7f6ace411b7f-4
if(!ctx.Web.ContentTypeExistsById(SiteClassificationContentType.SITEINFORMATION_CT_ID)) { // Content type. ContentType _contentType = ctx.Web.CreateContentType(SiteClassificationContentType.SITEINFORMATION_CT_NAME, SiteClassificationContentType.SITEINFORMATION_CT_DESC, SiteClassificationContentType....
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/implement-a-sharepoint-site-classification-solution
7f6ace411b7f-5
var _list = ctx.Web.Lists.Add(_newList); list.Hidden = true; list.ContentTypesEnabled = true; list.Update(); ctx.Web.AddContentTypeToListById(SiteClassificationList.SiteClassificationListTitle, SiteClassificationContentType.SITEINFORMATION_CT_ID, true); this.CreateCustomPropertiesInList(_list); ctx.Exe...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/implement-a-sharepoint-site-classification-solution
7f6ace411b7f-6
NavigationNode _nNode = _vNode.First<NavigationNode>(); ctx.Load(_nNode.Children); ctx.ExecuteQuery(); var vcNode = from NavigationNode cn in _nNode.Children where cn.Title == listName select cn; NavigationNode _cNode = vcNode.First<NavigationNode>(); _cNode.DeleteObject(); ctx.ExecuteQuery(); ...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/implement-a-sharepoint-site-classification-solution
7f6ace411b7f-7
} } } Note For more information, see Create a list in the host web when your SharePoint add-in is installed, and remove it from the recent stuff list . Add a classification indicator to site page You can add an indicator to a site page to show its classification. The Core.SiteClassification sample sh...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/implement-a-sharepoint-site-classification-solution
7f6ace411b7f-8
while (listItemEnumerator.moveNext()) { listItemInfo = listItemEnumerator.get_current().get_item('SC_METADATA_VALUE'); var pageTitle = $('#pageTitle')[0].innerHTML; if (pageTitle.indexOf("img") > -1) { classified = true; ...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/implement-a-sharepoint-site-classification-solution
7f6ace411b7f-9
} else if (siteClassification == "LBI") { var img = $("<a href='http://insertyourpolicy' target=_blank><img id=classifer name=classifer src='https://spmanaged.azurewebsites.net/content/img/lbi.png' title='Limited or no impact to Contoso if publically released.' alt='Limited o...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/implement-a-sharepoint-site-classification-solution
538f14457185-0
The samples described in this section show you how to use provider-hosted add-ins to perform common site provisioning tasks such as site classification, creating content types, and managing permissions and users. The articles in this section will help you get started with and walk you through the primary scenarios that...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/sharepoint-site-provisioning-solutions
18a6f6d9a799-0
OneDrive sites can be customized in Microsoft 365 or with the add-in model in general, based on company requirements. Actual techniques to perform this customization are different than in the on-premises scenario because only add-in model techniques can be used. Important This applies to only the classic OneD...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/customize-onedrive-for-business-sites
18a6f6d9a799-1
We don't recommend using content types and site columns in OneDrive sites. Use OneDrive sites for personal unstructured data and documents. Use team sites and collaboration sites for company data and documents, where you can use whatever information management policies and metadata you want. Customizations are defi...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/customize-onedrive-for-business-sites
18a6f6d9a799-2
In Microsoft 365, there's no centralized event raised that we could attach our custom code to when an OneDrive site is created. Therefore, we need to think about alternative solutions, which is common with add-in model approaches. Don't get stuck on old models; think about how to achieve the same end result using new A...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/customize-onedrive-for-business-sites
18a6f6d9a799-3
A classic example of these enterprise requirements is branding, and for that we already have Microsoft 365 theming introduced, which can be used to control some level of branding. The following diagram shows the current settings for Microsoft 365 theming, which can be applied across all Microsoft 365 services. Be...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/customize-onedrive-for-business-sites
18a6f6d9a799-4
App part is hosting a page from the provider-hosted add-in, 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 only receives the customization request, but doesn't actually apply any changes to keep the processing time nor...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/customize-onedrive-for-business-sites
18a6f6d9a799-5
Pre-create and apply configuration This option relies on the pre-creation of the OneDrive sites before users access them. This can be achieved by using relatively new API that provides us with a way to create OneDrive sites for specific users in a batch process by using either CSOM or REST. The needed code can be ini...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/customize-onedrive-for-business-sites
18a6f6d9a799-6
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 situation where a user can access the OneDrive sites before the customizations have been applied. At the same time, this option is an interesting add-on for other options...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/customize-onedrive-for-business-sites
1147445aabcb-0
You can refresh the branding on your existing SharePoint sites and site collections, as well as customize regions of SharePoint pages. You might want to do this, for example, when you update to a new version of the site. Important This extensibility option is only available for classic SharePoint experiences. Y...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/update-the-branding-of-existing-sharepoint-sites-and-page-regions
1147445aabcb-1
List<SiteEntity> sitesAndSubSites = new List<SiteEntity>(); if (applyChangesToAllWebs) { // You want to update all sites, so the list of sites is extended to all subsites. foreach (SiteEntity site in filteredSites) { sitesAndSubSites.Add(new SiteEntity() { Url = site.Url, ...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/update-the-branding-of-existing-sharepoint-sites-and-page-regions
1147445aabcb-2
if (!String.IsNullOrEmpty(themeName)) { // If no theme property bag entry, assume no theme has been applied. if (themeName.Equals(currentThemeName, StringComparison.InvariantCultureIgnoreCase)) { // The applied theme matches to the theme you want to update. int? brandingVersion = cc.Web.GetPropertyBagValu...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/update-the-branding-of-existing-sharepoint-sites-and-page-regions
1147445aabcb-3
if (IsThisASubSite(cc.Url)) { // Retrieve the context of the root site of the site collection. using (ClientContext ccParent = new ClientContext(GetRootSite(cc.Url))) { ccParent.Credentials = cc.Credentials; cc.Web.DeployThemeToSubWeb(ccParent.Web, themeName, spColorFile, spFontFile, backgroundFile, ""); ...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/update-the-branding-of-existing-sharepoint-sites-and-page-regions
1147445aabcb-4
Welcome menu *.master Can be hidden via the Focus on Content button. Settings menu or gear *.master Help *.master Ribbon contextual tabs Any default master page. For examples, see the following: SharePoint 2013 Duplicate Contextual Tabs Hide a Contextual ribbon tab Hide/Show context...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/update-the-branding-of-existing-sharepoint-sites-and-page-regions
1147445aabcb-5
Page title Corresponding CSS (in edit mode): Page Title and Page Title with Link: .ms-core-pageTitle, .ms-core-pageTitle a Description button: #ms-pageDescriptionDiv Description box: .js-callout-mainElement Description box arrow: .js-callout-beak Description text: .js-callout-body Search box Nav CSOM/...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/update-the-branding-of-existing-sharepoint-sites-and-page-regions
1147445aabcb-6
For more information, see Create a page layout in SharePoint For samples related to customizing regions of a page, see the following in the Office 365 Developer Patterns and Practices project on GitHub: Branding.AlternateCSSAndSiteLogo Branding.Themes Required "minimal" content placeholders in defaul...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/update-the-branding-of-existing-sharepoint-sites-and-page-regions
1147445aabcb-7
The bottom left navigation area (Left Navigation). PlaceHolderLeftNavBar The left navigation area (Left Navigation). PlaceHolderLeftNavBarDataSource The data source for the left navigation menu (Left Navigation). PlaceHolderLeftNavBarTop The top left navigation area (Left Navigation). Plac...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/update-the-branding-of-existing-sharepoint-sites-and-page-regions
1147445aabcb-8
PlaceHolderTitleAreaSeparator Shadows in the title area (Suite Navigation). PlaceHolderTitleBreadCrumb The title breadcrumb content area. PlaceHolderTitleLeftBorder The left border of the title area (Suite Navigation). PlaceHolderTitleRightMargin The right margin of the title area (Suite Navig...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/update-the-branding-of-existing-sharepoint-sites-and-page-regions
1147445aabcb-9
Content placeholders that are not visible still work as expected, but any content they generate is omitted from the HTML source that browsers recognize. A content placeholder with Visible="false" is hidden. Important Do not create custom placeholders in custom master pages that exist in out-of-the-box .master p...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/update-the-branding-of-existing-sharepoint-sites-and-page-regions
1147445aabcb-10
Location = "Text" RegistrationId = "Text" RegistrationType = "Text" RequireSiteAdministrator = "TRUE" | "FALSE" Rights = "Text" RootWebOnly = "TRUE" | "FALSE" ScriptSrc = "Text" ScriptBlock = "Text" Sequence = "Integer" ShowInLists = "TRUE" | "FALSE" ShowInReadOnlyContentTypes = "TRUE" | "FALSE" S...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/update-the-branding-of-existing-sharepoint-sites-and-page-regions
1147445aabcb-11
Customize Suite Navigation on a web part page In SharePoint, the UI has a modern look and feel that is based on page tiles. For example, Live Tiles appear on the default SharePoint page by default. The top navigation makes it easy for users to see and access social content and OneDrive for Business. You can customize...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/update-the-branding-of-existing-sharepoint-sites-and-page-regions
1147445aabcb-12
// Add a site actions link, if it doesn't already exist. if (!CustomActionAlreadyExists(clientContext, "Sample_CustomAction")) { UserCustomAction siteAction = clientContext.Web.UserCustomActions.Add(); siteAction.Group = "SiteActions"; siteAction.Location = "Microsoft.SharePoint.StandardMenu"; siteA...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/update-the-branding-of-existing-sharepoint-sites-and-page-regions
dbcc15c46c9c-0
You can use cascading style sheets (CSS) to customize SharePoint rich text fields and web part zones. To customize rich text fields, you can do this right on the page you're editing. For web part zones, you can use the Script Editor web part to add HTML or scripts, or associate a CSS style sheet. For a code sample th...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/customize-a-sharepoint-page-by-using-remote-provisioning-and-css
dbcc15c46c9c-1
namespace AlternateCSSAppAutohostedWeb.Services { public class AppEventReceiver : IRemoteEventService { public SPRemoteEventResult ProcessEvent(SPRemoteEventProperties properties) { SPRemoteEventResult result = new SPRemoteEventResult(); try { ...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/customize-a-sharepoint-page-by-using-remote-provisioning-and-css
dbcc15c46c9c-2
// Build a custom action to write a link to your new CSS file. UserCustomAction cssAction = hostWebObj.UserCustomActions.Add(); cssAction.Location = "ScriptLink"; cssAction.Sequence = 100; cssAction.ScriptBlock = @"document....
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/customize-a-sharepoint-page-by-using-remote-provisioning-and-css
dbf961cbb5b5-0
Cascading style sheet (CSS) plays a large role in SharePoint branding. To successfully customize the site design in SharePoint and SharePoint Online, it's useful to be familiar with how SharePoint uses CSS. Important This extensibility option is only available for classic SharePoint experiences. You cannot use ...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/use-css-to-brand-pages
dbf961cbb5b5-1
Consider the following example. <SharePoint:CssRegistration name="<% $SPUrl:~SiteCollection/Style Library/~language/Core Styles/contoso.css%>" runat="server"/> At runtime, this code is rendered as follows. <link rel="stylesheet" type="text/css" href="/sites/nopub/Style%20Library/Core%20Styles/contoso.css"> Th...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/use-css-to-brand-pages
dbf961cbb5b5-2
When you view the file, you'll notice many comments in this format: /* [ReplaceFont ( themeFont:"body")] */ . SharePoint reads these comments when a composed look is applied. The comments tell SharePoint to change the attribute of the CSS that immediately follows the comment. Applying a composed look might change many...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/use-css-to-brand-pages
dbf961cbb5b5-3
Composed looks in custom branding You can use composed looks in custom branding when CSS is called from a master page. The CSS file is stored in the SharePoint file system in one of the following locations: 15\TEMPLATE\LAYOUTS\{LCID}\STYLES\Themable /Style Library/Themable/ /Style Library/{culture}/Themab...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/use-css-to-brand-pages
dbf961cbb5b5-4
The following code example shows how to upload custom CSS to the asset library, apply a reference to the CSS URL with a custom action, and then create a custom action to build a link to the new CSS file. This code is part of the Branding.AlternateCSSAndSiteLogo sample on GitHub. using System; using System.Collect...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/use-css-to-brand-pages
dbf961cbb5b5-5
using System.IO; using Microsoft.SharePoint.Client; using Microsoft.SharePoint.Client.EventReceivers; namespace AlternateCSSAppAutohostedWeb.Services { public class AppEventReceiver : IRemoteEventService { public SPRemoteEventResult ProcessEvent(SPRemoteEventProperties properties) { ...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/use-css-to-brand-pages
dbf961cbb5b5-6
// Run uploads and initialize the existing Actions collection. clientContext.ExecuteQuery(); // Clean up existing actions. foreach (var existingAction in existingActions) { if(existingAction.Name...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/use-css-to-brand-pages
cc34b28b237d-0
You can apply and interact with themes by using remote provisioning features in SharePoint. These features are provided by the following APIs: ApplyTheme method ThemeInfo class Important This extensibility option is only available for classic SharePoint experiences. You cannot use this option with moder...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/use-remote-provisioning-to-brand-sharepoint-pages
cc34b28b237d-1
Note The shareGenerated parameter determines whether the themed output files are stored in a web-specific location or a location that is accessible across the site collection. We recommend that you keep the default value for your site type. ThemeInfo class You can use CSOM code to get information about the comp...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/use-remote-provisioning-to-brand-sharepoint-pages
cc34b28b237d-2
namespace ApplyThemeAppWeb.Pages { public partial class Default : System.Web.UI.Page { public string _ContextToken { get { if (ViewState["ContextToken"] == null) return null; return ViewState["ContextToken"].ToString();...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/use-remote-provisioning-to-brand-sharepoint-pages
cc34b28b237d-3
// Get the initial theme info for the web. No need to load the entire web object. clientContext.Load(hostWebObj, w => w.ThemeInfo, w => w.CustomMasterUrl); // Theme component info is available via a method call that must be run. var linkShade = initialThemeInfo.GetThemeS...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/use-remote-provisioning-to-brand-sharepoint-pages
cc34b28b237d-4
// First, copy theme files to a temporary location (the web's Site Assets library). Web hostWebObj = clientContext.Web; Site hostSiteObj = clientContext.Site; Web hostRootWebObj = hostSiteObj.RootWeb; // Get the necessary lists and librari...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/use-remote-provisioning-to-brand-sharepoint-pages
cc34b28b237d-5
// First, upload the theme files to the Theme Gallery. DirectoryInfo themeDir = new DirectoryInfo(Server.MapPath("/Theme")); foreach (var themeFile in themeDir.EnumerateFiles()) { FileCreationInformation newFile = new FileCreationInformation(); ...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/use-remote-provisioning-to-brand-sharepoint-pages
cc34b28b237d-6
FieldUrlValue masterFieldValue = new FieldUrlValue(); masterFieldValue.Url = masterFolderUrl + "/seattle.master"; newLookItem["MasterPageUrl"] = masterFieldValue; FieldUrlValue colorFieldValue = new FieldUrlValue(); colorFieldValue.Url = themeFolderUrl + ...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/use-remote-provisioning-to-brand-sharepoint-pages
380ad9f6672a-0
Composed looks are out-of-the-box themes that are included in SharePoint and SharePoint Online. Apply composed looks, including colors, fonts, and a background image, to your SharePoint and SharePoint Online sites by using the SharePoint theming engine. Important This extensibility option is only available for...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/use-composed-looks-to-brand-sharepoint-sites
380ad9f6672a-1
.spcolor Theme Gallery\15 folder Yes Font scheme .spfont Theme Gallery\15 folder No Site layout .master .preview Master Page Gallery Yes Background image .jpg .bmp .png .gif Site assets No Users can select composed looks by using the Change the Look Wizard ( Site Settings...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/use-composed-looks-to-brand-sharepoint-sites
380ad9f6672a-2
<s:color name="BodyText" value="444444" /> Line 2 of the .spcolor file defines the XML namespace, preview slots, and whether colors are inverted (they have a light foreground on a dark background instead of a dark foreground on a light background). The .spcolor file contains 89 color slots. You can use color slots...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/use-composed-looks-to-brand-sharepoint-sites
380ad9f6672a-3
Font schemes In the same way that color palettes define how colors are used in composed looks, font schemes define the fonts in composed looks. Font schemes are defined in the .spfont file stored in the Theme Gallery. The .spfont file includes the following font slots that define the name, typeface, and script valu...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/use-composed-looks-to-brand-sharepoint-sites
380ad9f6672a-4
<s:latin typeface="Georgia"/> <s:font script="Arab" typeface="Calibri" /> <s:font script="Deva" typeface="Mangal" /> . . . </s:fontSlot> </s:fontSlots> </s:fontScheme> Site layout: master pages and corresponding preview files The theming engine defines the site layout of a comp...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/use-composed-looks-to-brand-sharepoint-sites
380ad9f6672a-5
Download a copy of one of the .spcolor files (for example, Palette001.spcolor) and open it in a text editor. Edit the copied .spcolor file to reflect your design guidelines. For example, if you have a black font for main body text, edit the file to change the line <s:color name="BodyText" value="444444" /> to <s...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/use-composed-looks-to-brand-sharepoint-sites