id
stringlengths
14
16
text
stringlengths
2
3.14k
source
stringlengths
45
175
66e821cd5d32-3
using (var clientContext = spContext.CreateUserClientContextForSPHost()) { // Load user profile properties. PeopleManager peopleManager = new PeopleManager(clientContext); PersonProperties personProperties = peopleManager.GetMyProperties(); cli...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/personalize-search-results-sample-app-for-sharepoint
4ff5f0dd8038-0
The Core.ProfileProperty.Migration sample shows you how to migrate user profile data from SharePoint Server into SharePoint Online. This sample includes two console applications. Both use the userprofileservice.asmx web service to extract single and multivalued user profile data to an XML file, and to import the extr...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/migrate-user-profile-properties-sample-app-for-sharepoint
4ff5f0dd8038-1
Under Application , in Target framework , choose .NET Framework 4 . Choose Yes , and then choose Save . Table 1. Configuration settings for App.config file Configuration setting name Description Example MYSITEHOSTURL My Site URL on the source SharePoint Server farm. http://my.co...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/migrate-user-profile-properties-sample-app-for-sharepoint
4ff5f0dd8038-2
In the App.config file, change the value element of the Contoso_ProfileProperty_Migration_Import_UPSvc_UserProfileService setting to include a reference to the user profile service in your SharePoint Online admin center, as shown in the following example. <applicationSettings> <Contoso.ProfileProperty.Migrati...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/migrate-user-profile-properties-sample-app-for-sharepoint
4ff5f0dd8038-3
SPOAdminPassword An Office 365 administrator’s password. Not applicable. Using the Core.ProfileProperty.Migration sample add-in This code sample runs as a console application. When the code sample runs, the Main function in Program.cs performs the following tasks: Connects to the My Site host and us...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/migrate-user-profile-properties-sample-app-for-sharepoint
4ff5f0dd8038-4
try { if (Convert.ToBoolean(ConfigurationManager.AppSettings["TESTRUN"])) { LogMessage(string.Format("******** RUNNING IN TEST RUN MODE **********"), LogLevel.Debug); } LogMessage(string.Format("Connecting ...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/migrate-user-profile-properties-sample-app-for-sharepoint
4ff5f0dd8038-5
foreach (UserProfile spUser in profileManager) { // Get profile information. LogMessage(string.Format("processing user '{0}' of {1}...", userCount,profileManager.Count),LogLevel.Info); UserProfileData user...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/migrate-user-profile-properties-sample-app-for-sharepoint
4ff5f0dd8038-6
if (propCollection[0] != null) { returnString = propCollection[0].ToString(); } else { LogMessage(string.Format("User '{0}' does not have a value in property '{1}'", spUser.DisplayName, userProperty), LogLevel.Warnin...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/migrate-user-profile-properties-sample-app-for-sharepoint
4ff5f0dd8038-7
return sb.ToString(); } Using the Contoso.ProfileProperty.Migration.Import sample add-in This code sample runs as a console application. When the code sample runs, the Main method in Program.cs does the following: Initializes the console application using InitializeConfiguration and InitializeWeb...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/migrate-user-profile-properties-sample-app-for-sharepoint
4ff5f0dd8038-8
// Setting up the user profile web service. _userProfileService = new UPSvc.UserProfileService(); _userProfileService.Url = adminWebServiceUrl; // Assign previously created auth container to admin profile web service. _userProfileService.CookieContainer ...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/migrate-user-profile-properties-sample-app-for-sharepoint
4ff5f0dd8038-9
try { string[] arrs = PropertyValue.Split(ConfigurationManager.AppSettings["PROPERTYSEPARATOR"][0]); UPSvc.ValueData[] vd = new UPSvc.ValueData[arrs.Count()]; for (int i=0;i<=arrs.Count()-1;i++) { ...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/migrate-user-profile-properties-sample-app-for-sharepoint
4ff5f0dd8038-10
try { UPSvc.PropertyData[] data = new UPSvc.PropertyData[1]; data[0] = new UPSvc.PropertyData(); data[0].Name = PropertyName; data[0].IsValueChanged = true; data[0].Values = new UPSvc.ValueData[1]; data[0].Values...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/migrate-user-profile-properties-sample-app-for-sharepoint
dc43b0164010-0
As part of the client-side object model (CSOM) version (4622.1208 or later), SharePoint has the ability to bulk import custom user profile properties. Prior to this release, your only option was to take advantage of the user profile CSOM operations for updating specific properties for individual user profiles. However,...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/bulk-user-profile-update-api-for-sharepoint-online
dc43b0164010-1
Extended user profile information is available within user profiles and can be used for any out-of-the-box or custom functionality in SharePoint Online. Note The import only works for user profile properties that have not been set to be editable by end users. This is to prevent the user profile import process...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/bulk-user-profile-update-api-for-sharepoint-online
dc43b0164010-2
In the case of any exception during the import process, SharePoint provides additional logging information saved in the same document library where the file existed within a new sub folder. Cleaning of the log files and JSON files is not done automatically and is the responsibility of the custom solution using the AP...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/bulk-user-profile-update-api-for-sharepoint-online
dc43b0164010-3
}, { "<IdName>": "<UserIdValue_2>", "<AttributeName_1>": "<User2_AttributeValue_1>", "<AttributeName_2>": "<User2_AttributeValue_2>", }, { "<IdName>": "<UserIdValue_n>", "<AttributeName_1>": "<Usern_AttributeValue_1>", "<AttributeName_2>": "<Usern_AttributeValue_...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/bulk-user-profile-update-api-for-sharepoint-online
dc43b0164010-4
Source data file restrictions The following are restrictions on individual source data files: Maximum file size: 2 GB Maximum number of properties: 500,000 Backslashes () in property values need escaping by prepending with another backslash The source file must be uploaded to the same SharePoint Online tena...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/bulk-user-profile-update-api-for-sharepoint-online
dc43b0164010-5
Parameters idType : ImportProfilePropertiesUserIdType The type of id to use when looking up the user profile. Possible values are Email , CloudId , and PrincipalName . Note that regardless of the type, the user must already exist in the user profile service for the import to work. We recommend using the Clou...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/bulk-user-profile-update-api-for-sharepoint-online
dc43b0164010-6
Office365Tenant tenant = new Office365Tenant(ctx); ctx.Load(tenant); ctx.ExecuteQuery();
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/bulk-user-profile-update-api-for-sharepoint-online
dc43b0164010-7
// Type of user identifier ["PrincipalName", "Email", "CloudId"] in the // user profile service. In this case, we use Email as the identifier at the UPA storage ImportProfilePropertiesUserIdType userIdType = ImportProfilePropertiesUserIdType.Email; // Name of the user identifier property within the JSON file var...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/bulk-user-profile-update-api-for-sharepoint-online
dc43b0164010-8
ctx.ExecuteQuery(); Check the status of an import job You can check the status of the user profile service import jobs by using the CSOM APIs. There are two methods for this in the Tenant object: To check the status of an individual import job, use the GetImportProfilePropertyJob method. To check the statu...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/bulk-user-profile-update-api-for-sharepoint-online
dc43b0164010-9
public ImportProfilePropertiesJobStatusCollection GetImportProfilePropertyJobs();  Parameters An ImportProfilePropertiesJobInfo object returned with the import status information has the following properties.  JobId : System.Guid The ID of the import job. State : ImportProfilePropertiesJobState An e...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/bulk-user-profile-update-api-for-sharepoint-online
dc43b0164010-10
Return value An ImportProfilePropertiesJobStatusCollection object, which is a collection of ImportProfilePropertiesJobStatus objects with high level status information about each of the jobs. Example Following is an example that uses C# for getting the status of all import jobs currently saved in the tenant. ...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/bulk-user-profile-update-api-for-sharepoint-online
dc43b0164010-11
$pwd = Read-Host -Prompt 'Enter your password' -AsSecureString $importFileUrl = Read-Host -Prompt 'Enter the URL to the file located in your tenant'
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/bulk-user-profile-update-api-for-sharepoint-online
dc43b0164010-12
# Get instances to the Office 365 tenant using CSOM $uri = New-Object System.Uri -ArgumentList $adminUrl $context = New-Object Microsoft.SharePoint.Client.ClientContext($uri) $context.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($userName, $pwd) $o365 = New-Object Microsoft.Online.S...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/bulk-user-profile-update-api-for-sharepoint-online
dc43b0164010-13
# Output the unique identifier of the job Write-Host "Import job created with the following identifier:" $workItemId.Value Updating the SharePoint Online User Profile using PnP PowerShell To synchronize user profile properties from Azure Active Directory to SharePoint Online user profiles, you can leverage the Pn...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/bulk-user-profile-update-api-for-sharepoint-online
dc43b0164010-14
The actual log file is saved in the sub folder, and you can download that from Office 365 for detailed analysis. Common exceptions The following table contains typical exceptions that you could encounter when you start using the user profile service bulk API. Example exception Details Property...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/bulk-user-profile-update-api-for-sharepoint-online
dc43b0164010-15
IdentityNotResolvable unknown@contoso.com User identity cannot be resolved The data file contained an identity, which could not be resolved or was not present in the user profile service. In this case, the user profile with email of unknown@contoso.com could not be located in the user profile service. DataFil...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/bulk-user-profile-update-api-for-sharepoint-online
dc43b0164010-16
This API is updating properties in the user profile service, but how would I create those properties in the tenant? There’s no remote API to create custom user profile properties programmatically, so this is a manual operation that needs to be completed once per given tenant. For instructions about how to create thes...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/bulk-user-profile-update-api-for-sharepoint-online
dc43b0164010-17
If your code/script defines a mapping that is not used or the data file does not contain properties for that mapping, execution continues without any exceptions, and the import is applied based on the mapped properties. However, if you have a property in the JSON file that is not mapped, the import process is aborted, ...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/bulk-user-profile-update-api-for-sharepoint-online
dc43b0164010-18
DisplayName PreferredName telephoneNumber WorkPhone proxyAddresses WorkEmail proxyAddresses SPS-SIPAddress PhysicalDeliveryOfficeName Office Title Title Title SPS-JobTitle Department Department Department SPS-Department ObjectGuid ADGuid WW...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/bulk-user-profile-update-api-for-sharepoint-online
34635fb5324f-0
The UserProfile.Manipulation.CSOM sample shows you how to read and update user profile properties for a particular user. This sample uses a provider-hosted add-in to: Read and display all user profile properties for a user. Update a single-valued user profile property. Update a multivalued user profile property...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/read-or-update-user-profile-properties-sample-app-for-sharepoint
34635fb5324f-1
Choose Save all and close . Using the UserProfile.Manipulation.CSOM sample add-in When you run this sample, a provider-hosted add-in starts, as shown in the following figure. This code sample includes three scenarios. Scenario Shows how to 1 Read all user profile properties for the user...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/read-or-update-user-profile-properties-sample-app-for-sharepoint
34635fb5324f-2
using (var clientContext = spContext.CreateUserClientContextForSPHost()) { // Get the people manager instance and load current properties. PeopleManager peopleManager = new PeopleManager(clientContext); PersonProperties personProperties = peopleManager.GetMyProperties(); clientContext.Load(personPrope...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/read-or-update-user-profile-properties-sample-app-for-sharepoint
34635fb5324f-3
// Output user profile properties to a text box. txtProperties.Text = ""; foreach (var item in personProperties.UserProfileProperties) { txtProperties.Text += string.Format("{0} - {1}{2}", item.Key, item.Value, Environment.NewLine); } } } Scenario 2: Update a single-valued user profile proper...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/read-or-update-user-profile-properties-sample-app-for-sharepoint
34635fb5324f-4
using (var clientContext = spContext.CreateUserClientContextForSPHost()) { // Get the people manager instance and initialize the account name. PeopleManager peopleManager = new PeopleManager(clientContext); PersonProperties personProperties = peopleManager.GetMyProperties(); clientContext.Load(personP...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/read-or-update-user-profile-properties-sample-app-for-sharepoint
34635fb5324f-5
// Update the AboutMe property for the user using account name from the user profile. peopleManager.SetSingleValueProfileProperty(personProperties.AccountName, "AboutMe", updatedValue); clientContext.ExecuteQuery(); } } Note If you use custom user profile properties, configure the property to be editab...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/read-or-update-user-profile-properties-sample-app-for-sharepoint
34635fb5324f-6
The account name of the user whose user profile is being updated. The user profile property name, which is SPS-Skills . The property values as a List of string objects. protected void btnScenario3_Click(object sender, EventArgs e) { var spContext = SharePointContextProvider.Current.GetSharePointConte...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/read-or-update-user-profile-properties-sample-app-for-sharepoint
34635fb5324f-7
using (var clientContext = spContext.CreateUserClientContextForSPHost()) { // Get the people manager instance and initialize the account name. PeopleManager peopleManager = new PeopleManager(clientContext); PersonProperties personProperties = peopleManager.GetMyProperties(); clientContext.Load(personP...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/read-or-update-user-profile-properties-sample-app-for-sharepoint
9903d6923fa5-0
The user profiles solution pack includes code samples and documentation that you can use to work with user profile properties and personalize your SharePoint solution. The samples in this solution pack show you how to use provider-hosted add-ins to work with SharePoint user profile data. The articles in this sect...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/user-profile-solutions-for-sharepoint
f58601faac01-0
When you're using InfoPath forms with code-behind, the forms depend on code-based sandbox solutions for executing the code-behind. This article helps you to either fix or transform your InfoPath forms so they are no longer dependent on sandbox solutions. Note Code-based sandbox solutions were deprecated in 2014,...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/sandbox-solution-transformation-guidance-infopath
f58601faac01-1
Typically the data was created as InfoPath XML files that live in a SharePoint list. If you remove the form, you will no longer be able to visualize the data. Sometimes that's okay because the form and data are not relevant anymore. However, if you want to be able to access the data, you can convert the data coming fro...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/sandbox-solution-transformation-guidance-infopath
f58601faac01-2
Fix your InfoPath forms The previous sections showed you the InfoPath forms with code-behind, but do these forms actually contain useful code-behind? There are many forms for which the form author accidentally chose the Code Editor button on the InfoPath Developer ribbon. If you've done this, you may have cod...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/sandbox-solution-transformation-guidance-infopath
f58601faac01-3
namespace Form1 { public partial class FormCode { // Member variables are not supported in browser-enabled forms. // Instead, write and read these values from the FormState // dictionary using code such as the following: // // private object _memberVariable // { ...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/sandbox-solution-transformation-guidance-infopath
f58601faac01-4
// NOTE: The following procedure is required by Microsoft InfoPath. // It can be modified using Microsoft InfoPath. public void InternalStartup() { } } } In case you only have the XSN file that you downloaded in the previous step, you can rename your XSN file as a cab file (for ...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/sandbox-solution-transformation-guidance-infopath
f58601faac01-5
Migrate your InfoPath forms If the guidance in the previous sections was not applicable to your InfoPath forms, it means that your forms are still business-relevant and contain code-behind that you cannot drop. If that's the case, the typical solution is to move away from InfoPath, which can be done in the following ...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/sandbox-solution-transformation-guidance-infopath
f58601faac01-6
Cascade data load Upload or delete attachments Add or remove user from site groups Load existing item in form Migrate your InfoPath data After you move your InfoPath forms to a new solution, you might also want to migrate your data from InfoPath XML to regular SharePoint list data or to the data layer of yo...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/sandbox-solution-transformation-guidance-infopath
58989da4b93c-0
Feature receivers are typically used to apply different kinds of configurations or settings to SharePoint sites when the feature is activated or when the site is created (if the feature is associated to a site template or web template). Feature receivers have been deployed by using sandbox solutions in SharePoint Onlin...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/sandbox-solution-transformation-guidance-feature-receivers
58989da4b93c-1
Code-based customization Applies the needed customizations by using managed code with remote APIs. This means that you either apply them as part of the administrative operation when the site is created, or you apply them to SharePoint, which hooks in your code to be part of the UI elements. Can require a hosting infr...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/sandbox-solution-transformation-guidance-feature-receivers
58989da4b93c-2
Using code Following is a simple code sample that uses SharePoint Online CSOM to activate a custom theme by first uploading the assets to a SharePoint site and then activating the custom theme. This sample uses the PnP CSOM Core Component , which extends the native out-of-the-box operations by introducing an addit...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/sandbox-solution-transformation-guidance-feature-receivers
58989da4b93c-3
Web web = clientContext.Web; // Loading RootWeb.ServerRelativeUrl property. clientContext.Load(clientContext.Site, w => w.RootWeb.ServerRelativeUrl); clientContext.ExecuteQuery(); // Let's first upload the contoso theme to host web, if it does not exist there. web.CreateComposedLookByUrl("Contoso", cli...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/sandbox-solution-transformation-guidance-feature-receivers
46f0f3227788-0
The approach you take to handle events in SharePoint is slightly different in the SharePoint Add-in model than it was with Full Trust Code or in coded-sandbox solutions. In typical previous solutions, event receivers were created by using the SharePoint Server-Side Object Model and deployed via solutions packages, whic...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/sandbox-solution-transformation-guidance-event-receivers
46f0f3227788-1
Webhooks Require hosting infrastructure. Hosting infrastructure must be highly available. Do not support synchronous events. Process changes after the event has occurred. Not available in SharePoint on-premises builds at this time. Overview of SharePoint webhooks Introducing SharePoint Webhooks Remote timer job...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/sandbox-solution-transformation-guidance-event-receivers
4b18d9f8df6a-0
One of the reasons many developers have leveraged code-based sandbox solutions is a desire to utilize visual web parts. This provides a great way to separate code from layout as well as utilize the ASP.NET controls. You can continue to use visual web parts in a provider-hosted add-in via client web parts. This is a gre...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/sandbox-solution-transformation-guidance-webparts
4b18d9f8df6a-1
Client-side solution The ability to embed JavaScript in the prescribed way (through a UserCustomAction) does not work currently outside of the classic experience. For these cases you can link to the files by using a Script Editor web part. Cannot elevate permissions, instead use a micro-service with add-in-only permi...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/sandbox-solution-transformation-guidance-webparts
d819fd65516c-0
Transforming your sandbox solutions to the SharePoint Add-in model involves analyzing your existing extensions, designing and developing your new SharePoint Add-ins, and then testing and deploying your add-in in your production environment. Note Code-based sandbox solutions were deprecated in 2014, and SharePoin...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/sandbox-solution-transformation-guidance
d819fd65516c-1
Planning the transformation process When you transform your sandbox solutions to the SharePoint Add-in model, you want to ensure that the impact on your users is minimal. Carefully analyze your current sandbox solutions, and then design your new SharePoint Add-in to meet the needs of your organization. We recommend t...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/sandbox-solution-transformation-guidance
d819fd65516c-2
The requirements gathered in the Solution assessment step. Your analysis of the existing code. During your code analysis, consider identifying portions of the code that can be dropped (for example, the code is no longer being used, or the requirements have changed). Develop and test the SharePoint Add-in mo...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/sandbox-solution-transformation-guidance
d819fd65516c-3
Web part Web parts are typically converted either to add-in parts or they are implemented with fully client-side technologies by using the JavaScript embed pattern. For more information, see: Customize your SharePoint site UI by using JavaScript Create add-in parts to install with your SharePoint Add-in How to upda...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/sandbox-solution-transformation-guidance
d819fd65516c-4
Removing sandbox code from your site When you deactivate your existing sandbox solution from sites, any assets or files deployed by using declarative options will not be removed. If you have used sandbox solutions to introduce new code-based web parts, those functionalities will be disabled from the sites. This means...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/sandbox-solution-transformation-guidance
f72fd50b9e23-0
You can use the transformation process to replace SharePoint web parts with add-in parts on pages by using CSOM to find and remove specific web parts, and then adding the new add-in parts. Important Farm solutions cannot be migrated to SharePoint Online. By applying the techniques and code described in this artic...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/replace-sharepoint-web-parts-with-add-in-parts
f72fd50b9e23-1
You have deployed your new add-in part to SharePoint. You have assigned your add-ins FullControl permissions on the Web . For more information, see Add-in permissions in SharePoint . Export the new add-in part To use CSOM to replace a web part with an add-in part, you need to get the add-in part definit...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/replace-sharepoint-web-parts-with-add-in-parts
f72fd50b9e23-2
<metaData> <type name="Microsoft.SharePoint.WebPartPages.ClientWebPart, Microsoft.SharePoint, Version=16.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" /> <importErrorMessage>Cannot import this web part.</importErrorMessage> </metaData> <data> <properties> <property name="Tit...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/replace-sharepoint-web-parts-with-add-in-parts
f72fd50b9e23-3
<property name="AllowZoneChange" type="bool">True</property> <property name="TitleUrl" type="string" /> <property name="ChromeType" type="chrometype">Default</property> <property name="AllowConnect" type="bool">True</property> <property name="Width" type="unit" /> <property name=...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/replace-sharepoint-web-parts-with-add-in-parts
f72fd50b9e23-4
private const string appPartXml = @"<webParts> <webPart xmlns=""http://schemas.microsoft.com/WebPart/v3""> <metaData> <type name=""Microsoft.SharePoint.WebPartPages.ClientWebPart, Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"" /> <importErrorMessage>Cannot i...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/replace-sharepoint-web-parts-with-add-in-parts
f72fd50b9e23-5
<property name=""AllowHide"" type=""bool"">True</property> <property name=""ProductWebId"" type=""System.Guid, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"">717c00a1-08ea-41a5-a2b7-4c8f9c1ce770</property> <property name=""AllowZoneChange"" type=""bool"">True</property> ...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/replace-sharepoint-web-parts-with-add-in-parts
f72fd50b9e23-6
</data> </webPart> </webParts>"; Find all pages with web parts to be replaced, and then remove the web parts Find the web parts to replace ReplaceWebPartsWithAppParts starts the process of finding the web parts to be replaced by: Getting some properties from the Web to find the Pages library on the si...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/replace-sharepoint-web-parts-with-add-in-parts
f72fd50b9e23-7
var list = web.Lists.GetByTitle(pagesListName); var items = list.GetItems(CamlQuery.CreateAllItemsQuery()); // Get the file associated with each list item. clientContext.Load(items, i => i.Include( item => item.File)); ...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/replace-sharepoint-web-parts-with-add-in-parts
f72fd50b9e23-8
foreach (var oldWebPartDefinition in webPartManager.WebParts) { var oldWebPart = oldWebPartDefinition.WebPart; // Modify the web part if we find an old web part with the same title. if (oldWebPart.Title != oldWebPartTitle) continue; ReplaceWebPart(web, item, webPartManager, old...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/replace-sharepoint-web-parts-with-add-in-parts
a0241eceafa8-0
If you used list definitions to create lists in your farm solution, learn how to transform them into new solutions that provide similar functionality by using the client object model (CSOM). Important Farm solutions cannot be migrated to SharePoint Online. By applying the techniques and code described in this art...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/replace-sharepoint-lists-created-from-list-definitions
a0241eceafa8-1
Add or remove views (optional). Migrate content from the original list to the new list. Before you begin Ideally, you should review your existing farm solutions, learn about the techniques described in this article, and then plan how to apply these techniques to your existing farm solutions. If you are unfa...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/replace-sharepoint-lists-created-from-list-definitions
a0241eceafa8-2
static void Main(string[] args) { using (var clientContext = new ClientContext("http://w15-sp/sites/ftclab")) { Web web = clientContext.Web; ListCollection listCollection = web.Lists; clientContext.Load(listCollection, l => l.Include(list => list.BaseTe...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/replace-sharepoint-lists-created-from-list-definitions
a0241eceafa8-3
SetListSettings(clientContext, listToBeReplaced, newList); SetContentTypes(clientContext, listToBeReplaced, newList); AddViews(clientContext, listToBeReplaced, newList); RemoveViews(clientContext, listToBeReplaced, newList);
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/replace-sharepoint-lists-created-from-list-definitions
a0241eceafa8-4
MigrateContent(clientContext, listToBeReplaced, newList); } Create a new list To create a new list, CreateReplacementList uses ListCreationInformation . The title of the new list is set to the title of the existing list, with Add-in appended to it. The ListTemplateType enumeration is used to set the li...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/replace-sharepoint-lists-created-from-list-definitions
a0241eceafa8-5
newList.EnableVersioning = listToBeReplaced.EnableVersioning; newList.EnableModeration = listToBeReplaced.EnableModeration; newList.EnableMinorVersions= listToBeReplaced.EnableMinorVersions; newList.DraftVersionVisibility = listToBeReplaced.DraftVersionVisibility; newList.Update(); clientContext.Exe...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/replace-sharepoint-lists-created-from-list-definitions
a0241eceafa8-6
For each content type in newList , determining whether the content type matches a content type in the original list based on ContentType.Name by using listToBeReplaced.ContentTypes.Any(ct => ct.Name == contentType.Name) . If a match is not found, the content type is added to contentTypesToDelete to be deleted fro...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/replace-sharepoint-lists-created-from-list-definitions
a0241eceafa8-7
// If the original list doesn't use content types, do not proceed any further. if (!listToBeReplaced.ContentTypesEnabled) return;
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/replace-sharepoint-lists-created-from-list-definitions
a0241eceafa8-8
newList.ContentTypesEnabled = true; newList.Update(); clientContext.ExecuteQuery(); foreach (var contentType in listToBeReplaced.ContentTypes) { if (!newList.ContentTypes.Any(ct => ct.Name == contentType.Name)) { // Current content type needs to be added to the new list. Note...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/replace-sharepoint-lists-created-from-list-definitions
a0241eceafa8-9
AddViews adds views from the original list to the new list by: Using List.Views to get all views on the original list. Using the lambda expression to load various view properties on the views collection. For each view in the original list, creating a view by using ViewCreationInformation . Various p...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/replace-sharepoint-lists-created-from-list-definitions
a0241eceafa8-10
// Build a list of views which exist on the original list only. var viewsToCreate = new List<ViewCreationInformation>(); foreach (View view in listToBeReplaced.Views) { var createInfo = new ViewCreationInformation { Paged = view.Paged, PersonalView = view.PersonalView, ...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/replace-sharepoint-lists-created-from-list-definitions
a0241eceafa8-11
private static ViewType GetViewType(string viewType) { switch (viewType) { case "HTML": return ViewType.Html; case "GRID": return ViewType.Grid; case "CALENDAR": return ViewType.Calendar; case "RECURRENCE": return ViewTyp...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/replace-sharepoint-lists-created-from-list-definitions
a0241eceafa8-12
var viewsToRemove = new List<View>(); foreach (View view in newList.Views) { if (!listToBeReplaced.Views.Any(v => v.Title == view.Title)) { // If there is no matching view in the source list, add the view to the list of views to be deleted. viewsToRemove.Add(view); ...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/replace-sharepoint-lists-created-from-list-definitions
a0241eceafa8-13
Note The following code returns all list items. In your production environment, consider optimizing the following code by implementing a loop, and using multiple iterations to migrate small amounts of list items. private static void MigrateContent(ClientContext clientContext, List listToBeReplaced, List newList) ...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/replace-sharepoint-lists-created-from-list-definitions
a0241eceafa8-14
foreach (File file in source.Files) { string newUrl = file.ServerRelativeUrl.Replace(source.ServerRelativeUrl, destination.ServerRelativeUrl); file.CopyTo(newUrl, true); //file.MoveTo(newUrl, MoveOperations.Overwrite); } clientContext.ExecuteQuery(); } Note The previous co...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/replace-sharepoint-lists-created-from-list-definitions
6ccf9c522cf3-0
If you deployed files declaratively by using modules in farm solutions, learn how to transform them into new solutions that update references to files and provide similar functionality by using the client object model (CSOM). In the past, modules were used to deploy files such as master pages and page layouts. Impo...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/replace-files-deployed-using-modules-in-sharepoint-farm-solutions
6ccf9c522cf3-1
Before you begin Ideally, you should review your existing farm solutions, learn about the techniques described in this article, and then plan how to apply these techniques to your scenarios. If you are unfamiliar with farm solutions or do not have an existing farm solution to work with, it might be helpful for you to...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/replace-files-deployed-using-modules-in-sharepoint-farm-solutions
6ccf9c522cf3-2
pageLayout element - Uses the file attribute to specify the new page layout file, the replaces attribute to specify the existing page layout file, and several other attributes to specify additional page layout information. <?xml version="1.0" encoding="utf-8" ?> <branding> <masterPages> <mas...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/replace-files-deployed-using-modules-in-sharepoint-farm-solutions
6ccf9c522cf3-3
In MasterPageGalleryFiles.cs, the MasterPageGalleryFile and LayoutFile classes define business objects that store information about the new master pages and page layouts to be uploaded to SharePoint. Upload and update references to master pages To upload and update references to the new master pages on your...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/replace-files-deployed-using-modules-in-sharepoint-farm-solutions
6ccf9c522cf3-4
return sStrPwd; } static string GetUserName() { string strUserName = string.Empty; try { Console.Write("Username: "); strUserName = Console.ReadLine(); } catch (Exception e) { Console.WriteLine(e.Mes...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/replace-files-deployed-using-modules-in-sharepoint-farm-solutions
6ccf9c522cf3-5
XDocument settings = XDocument.Load("settings.xml"); // Get a reference to the Master Page Gallery which will be used to upload new master pages. Web web = clientContext.Web; List gallery = web.GetCatalog(116); Folder folder = gallery.RootFolder; // Load additional Master Page Gallery properties...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/replace-files-deployed-using-modules-in-sharepoint-farm-solutions
6ccf9c522cf3-6
} In Program.cs, add the UploadAndSetMasterPages method, which creates a list of MasterPageGalleryFile business objects by: Reading all the masterPage elements defined in settings.xml. For each masterPage element, which specifies a master page to upload to SharePoint, loading the attribute valu...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/replace-files-deployed-using-modules-in-sharepoint-farm-solutions
6ccf9c522cf3-7
Checks in, publishes, and approves the new master page. If the current site's master page or custom master page URL is set to the old master page, updates Web.MasterUrl or Web.CustomMasterUrl to use the newly uploaded master page URL. private static void UploadAndSetMasterPage(Web web, Folder folder, ClientCo...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/replace-files-deployed-using-modules-in-sharepoint-farm-solutions
6ccf9c522cf3-8
// Use the FileCreationInformation class to upload the new file. var fileInfo = new FileCreationInformation(); fileInfo.ContentStream = fileReadingStream; fileInfo.Overwrite = true; fileInfo.Url = masterPage.File; File file = folder.Files.Add(fileInfo); // Get the list item associated with the newly up...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/replace-files-deployed-using-modules-in-sharepoint-farm-solutions
6ccf9c522cf3-9
// On the current site, update the master page references to use the new master page. if (web.MasterUrl.EndsWith("/" + masterPage.Replaces)) { web.MasterUrl = file.ServerRelativeUrl; } if (web.CustomMasterUrl.EndsWith("/" + masterPage.Replaces)) { web.CustomMasterUrl = file.ServerRelativeUrl; ...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/replace-files-deployed-using-modules-in-sharepoint-farm-solutions
6ccf9c522cf3-10
Web web = clientContext.Web; List gallery = web.GetCatalog(116); Folder folder = gallery.RootFolder; // Load additional Master Page Gallery properties. clientContext.Load(folder); clientContext.Load(gallery, g => g.ContentTypes, g => g.RootFolder.ServerRelativeUrl); // Load ...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/replace-files-deployed-using-modules-in-sharepoint-farm-solutions
6ccf9c522cf3-11
} In Program.cs, add the UploadPageLayoutsAndUpdateReferences method, which performs the following steps: Reads the page layout replacement information by reading the pagelayout elements from settings.xml, storing the page layout replacement information in LayoutFile business objects, and adding all ...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/replace-files-deployed-using-modules-in-sharepoint-farm-solutions
6ccf9c522cf3-12
{ ContentType associatedContentType = web.ContentTypes.FirstOrDefault(ct => ct.Name == pageLayout.AssociatedContentTypeName); pageLayout.AssociatedContentTypeId = associatedContentType.StringId; UploadPageLayout(web, folder, clientContext, pageLayout); }
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/replace-files-deployed-using-modules-in-sharepoint-farm-solutions
6ccf9c522cf3-13
UpdatePages(web, clientContext, pageLayouts); } In Program.cs, add the UploadPageLayout method, which performs the following tasks: Checks out the page layout file. Uploads the new file by using FileCreationInformation . Gets the list item associated with the newly uploaded file. S...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/replace-files-deployed-using-modules-in-sharepoint-farm-solutions
6ccf9c522cf3-14
item["ContentTypeId"] = pageLayout.ContentTypeId; item["Title"] = pageLayout.Title; item["PublishingAssociatedContentType"] = string.Format(";#{0};#{1};#", pageLayout.AssociatedContentTypeName, pageLayout.AssociatedContentTypeId); item.Update(); clientContext.ExecuteQuery(); PublishingHelper.CheckInPublis...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/replace-files-deployed-using-modules-in-sharepoint-farm-solutions
6ccf9c522cf3-15
if (pageLayout.DefaultLayout) { PublishingHelper.SetDefaultPageLayout(web, clientContext, file); } } } In Program.cs, add the UpdatePages method, which performs the following tasks: Gets the Pages library, and then gets all the list items in the Pages library. For each list item, use...
https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/replace-files-deployed-using-modules-in-sharepoint-farm-solutions