id stringlengths 14 16 | text stringlengths 2 3.14k | source stringlengths 45 175 |
|---|---|---|
3cdef1ac2eab-7 | context.ExecuteQuery();
// Print the results
Console.WriteLine(
"File Properties [UniqueId:{0}] [ServerRelativePath:{1}]",
file.UniqueId,
file.ServerRelativePath.DecodedUrl);
REST scenarios
Get Folders
url: http://site url/_api/web/GetFolderByServerRelativePath(decodedUrl='library name/folder n... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/supporting-and-in-file-and-folder-with-the-resourcepath-api |
3cdef1ac2eab-8 | Create Folder
url: http://site url/_api/web/Folders/AddUsingPath(decodedurl='/document library relative url/folder name')
method: POST
headers:
Authorization: "Bearer " + accessToken
X-RequestDigest: form digest value
accept: "application/json;odata=verbose"
content-type: "application/json;odata=verbose"
... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/supporting-and-in-file-and-folder-with-the-resourcepath-api |
2290bf473ebe-0 | The Core.MMSSync sample shows you how to use a provider-hosted add-in to synchronize a source and target taxonomy. This add-in synchronizes two term stores in the managed metadata service—a source and a target term store.
The following objects are used to synchronize term groups:
TermStore
ChangeInformation
... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/synchronize-term-groups-sample-app-for-sharepoint |
2290bf473ebe-1 | The URL of the Office 365 admin center that contains the source term store (this is the URL of the source managed metadata service). For example, you might enter https://contososource-admin.sharepoint.com .
The user name and password of a term store administrator on your source managed metadata service.
The URL of... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/synchronize-term-groups-sample-app-for-sharepoint |
2290bf473ebe-2 | Verifies that the languages of the source and target term stores match.
Verifies that the source term group doesn't exist in the target term store, and then copies the source term group to the target term store by using CreateNewTargetTermGroup .
You can set the TermGroupExclusions , TermGroupToCopy , an... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/synchronize-term-groups-sample-app-for-sharepoint |
2290bf473ebe-3 | List<int> languagesToProcess = null;
if (!ValidTermStoreLanguages(sourceTermStore, targetTermStore, out languagesToProcess))
{
Log.Internal.TraceError((int)EventId.LanguageMismatch, "The target termstore default language is not available as language in the source term store, sync... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/synchronize-term-groups-sample-app-for-sharepoint |
2290bf473ebe-4 | if (sourceTermGroup == null)
{
continue;
}
if (targetTermGroup != null)
{
if (sourceTermGroup.Id != targetTermGroup.Id)
{
// Term group exists with a different ID, unable t... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/synchronize-term-groups-sample-app-for-sharepoint |
2290bf473ebe-5 | TermSetCollection sourceTermSetCollection = sourceTermGroup.TermSets;
if (sourceTermSetCollection.Count > 0)
{
foreach (TermSet sourceTermSet in sourceTermSetCollection)
{
sourceClientContext.Load(sourceTermSet,
... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/synchronize-term-groups-sample-app-for-sharepoint |
2290bf473ebe-6 | Term targetTerm;
if (reusedTerm.ServerObjectIsNull.Value)
{
try
{
targetTerm = targetTermSet.CreateTerm(sourceTerm.Name, targetTermStore.DefaultLanguage, sourceTerm.Id);
... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/synchronize-term-groups-sample-app-for-sharepoint |
2290bf473ebe-7 | Scenario 2 - Process changes
When you select Process Changes , the add-in prompts you to enter a Term Group to synchronize, and then calls the ProcessChanges method in MMSSyncManager.cs. ProcessChanges uses the GetChanges method of the ChangedInformation class to retrieve all changes made to groups, term set... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/synchronize-term-groups-sample-app-for-sharepoint |
2290bf473ebe-8 | The GetChanges method returns a ChangedItemCollection , which enumerates all changes occurring in the term store, as shown in the following code example. The last line of the example checks to determine whether the ChangedItem was a term group. ProcessChanges includes code to perform similar checks on the Chang... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/synchronize-term-groups-sample-app-for-sharepoint |
2290bf473ebe-9 | #region Group changes
if (_changeItem.ItemType == ChangedItemType.Group)
The changed item type might be a term group, term set, or term. Each changed item type has different operations that you can perform on it. The following table lists the operations that you can perform on each changed ite... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/synchronize-term-groups-sample-app-for-sharepoint |
92007b8ed900-0 | The Core.LargeFileUpload sample shows you how to use a provider-hosted add-in to upload large files to SharePoint, and how to bypass the 2-MB file upload limit.
Use this solution if you want to upload files that are larger than 2 MB to SharePoint.
This sample runs as a console application that uploads large files t... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/upload-large-files-sample-app-for-sharepoint |
92007b8ed900-1 | No file size limits. Time-out occurs after 30 minutes.
Recommended for: - SharePoint Server - SharePoint Online when the file is smaller than 10 MB.
SharePoint Server, SharePoint Online
Upload a single file as a set of chunks using the StartUpload , ContinueUpload , and FinishUpload methods on the File ... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/upload-large-files-sample-app-for-sharepoint |
92007b8ed900-2 | // Ensure that target library exists. Create if it is missing.
if (!LibraryExists(ctx, web, libraryName))
{
CreateLibrary(ctx, web, libraryName);
}
FileCreationInformation newFile = new FileCreationInformation();
// The next line of code causes an exception to be thrown for files larger than 2 MB.
new... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/upload-large-files-sample-app-for-sharepoint |
92007b8ed900-3 | using (FileStream fs = new FileStream(filePath, FileMode.Open))
{
Microsoft.SharePoint.Client.File.SaveBinaryDirect(ctx, string.Format("/{0}/{1}", libraryName, System.IO.Path.GetFileName(filePath)), fs, true);
}
}
In FileUploadService.cs , UploadDocumentContentStream uses the FileCreationInformation.Cont... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/upload-large-files-sample-app-for-sharepoint |
92007b8ed900-4 | ctx.Load(uploadFile);
ctx.ExecuteQuery();
}
}
In FileUploadService.cs , UploadFileSlicePerSlice uploads a large file to a document library as a set of chunks or fragments. UploadFileSlicePerSlice performs the following tasks:
Gets a new GUID. To upload a file in chunks, you must use a unique GUID.
C... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/upload-large-files-sample-app-for-sharepoint |
92007b8ed900-5 | If the chunk size isn't equal to the file size, there's more than one chunk to read from the file. File.StartUpload is called to upload the first chunk. fileoffset , which is used as the starting point of the next chunk, is then set to the number of bytes uploaded from the first chunk. When the next chunk is read, i... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/upload-large-files-sample-app-for-sharepoint |
92007b8ed900-6 | Resume an interrupted chunk by tracking which chunks uploaded successfully.
Chunks must be uploaded in sequential order. You can't upload slices concurrently (for example, by using a multithreaded approach).
public Microsoft.SharePoint.Client.File UploadFileSlicePerSlice(ClientContext ctx, string libraryName, s... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/upload-large-files-sample-app-for-sharepoint |
92007b8ed900-7 | // Get the name of the file.
string uniqueFileName = Path.GetFileName(fileName);
// Ensure that target library exists, and create it if it is missing.
if (!LibraryExists(ctx, ctx.Web, libraryName))
{
CreateLibrary(ctx, ctx.Web, libraryName);
}
// Get the folder to upload into.
List docs = ctx.Web.Lis... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/upload-large-files-sample-app-for-sharepoint |
92007b8ed900-8 | FileStream fs = null;
try
{
fs = System.IO.File.Open(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
using (BinaryReader br = new BinaryReader(fs))
{
byte[] buffer = new byte[blockSize];
Byte[] lastBuffer = null;
long fileoffset = 0;
long totalBy... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/upload-large-files-sample-app-for-sharepoint |
92007b8ed900-9 | // You can only start the upload once.
first = false;
}
}
else
{
if (last)
{
// Is this the last slice of data?
using (MemoryStream s = new MemoryStream(lastBuffer))
{
// End sliced ... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/upload-large-files-sample-app-for-sharepoint |
1615dd23338d-0 | Note
The sample uploads one file to a document library. To upload multiple files, you'll need to extend the sample.
The Core.BulkDocumentUploader sample add-in uses a console application to upload files by using REST API calls. Configuration settings are specified in an XML and a CSV file.
Use this solution if ... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/bulk-upload-documents-sample-app-for-sharepoint |
1615dd23338d-1 | Add the file path of the OneDriveUploader.xml file as a command-line argument. To do this, open the Core.BulkDocumentUploader project properties in Solution Explorer, and then choose Properties > Debug .
Using the Core.BulkDocumentUploader sample add-in
From the Main method in Program.cs, the RecurseAct... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/bulk-upload-documents-sample-app-for-sharepoint |
1615dd23338d-2 | logger.LogVerbose(string.Format("Attempting to read mapping CSV file '{0}'", this.UserMappingCSVFile));
using (StreamReader reader = new StreamReader(this.UserMappingCSVFile))
{
csvProcessor.Execute(reader, (entries, y) => { IterateCollection(entries, logger); }, logger);
... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/bulk-upload-documents-sample-app-for-sharepoint |
1615dd23338d-3 | // Ensure that the account has permissions to access.
BasePermissions perm = new BasePermissions();
perm.Set(PermissionKind.AddListItems);
ConditionalScope scope = new ConditionalScope(context, () => context.Web.DoesUserHavePermissions(perm).Value... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/bulk-upload-documents-sample-app-for-sharepoint |
1615dd23338d-4 | // Build out additional HTTP request details.
SPORequest.Accept = "application/json;odata=verbose";
SPORequest.Headers.Add("X-RequestDigest", digest.DigestValue);
SPORequest.ContentLength = s.Length;
... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/bulk-upload-documents-sample-app-for-sharepoint |
1615dd23338d-5 | }
}
}
}
catch(Exception ex)
{
logger.LogVerbose(string.Format(CultureInfo.CurrentCulture, "There was an issue performing '{0}' on to the URL '{1}' with exception: {2}", this.DocumentAction, entries[this.SiteIndex], ex.Message));
... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/bulk-upload-documents-sample-app-for-sharepoint |
1cc6bad3dc6d-0 | The Core.MMS sample console application shows you how to interact with the SharePoint managed metadata service to create and retrieve terms, term sets, and groups. This sample also runs in a provider-hosted add-in, such as an ASP.NET MVC web application.
Use this solution if you want to migrate terms between SharePoi... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/taxonomy-operations-sample-app-for-sharepoint |
1cc6bad3dc6d-1 | cc.AuthenticationMode = ClientAuthenticationMode.Default;
// For SharePoint Online.
cc.Credentials = new SharePointOnlineCredentials(userName, pwd);
The following code performs user authentication in SharePoint Online Dedicated or in an on-premises SharePoint farm.
ClientContext cc = new ClientContext(siteUrl);
... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/taxonomy-operations-sample-app-for-sharepoint |
1cc6bad3dc6d-2 | if (taxonomySession != null)
{
TermStore termStore = taxonomySession.GetDefaultSiteCollectionTermStore();
if (termStore != null)
{
//
// Create group, termset, and terms.
//
TermGr... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/taxonomy-operations-sample-app-for-sharepoint |
1cc6bad3dc6d-3 | cc.ExecuteQuery();
}
}
}
After creating the new terms, the GetMMSTermsFromCloud() method retrieves all term groups, term sets, and terms from the managed metadata service. Similar to the CreateNecessaryMMSTermsToCloud() method, the code first gets a reference to the Taxonom... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/taxonomy-operations-sample-app-for-sharepoint |
1cc6bad3dc6d-4 | foreach (Term term in termSet.Terms)
{
// Writes root-level terms only.
Console.WriteLine("Term " + term.Name);
}
}
}
}
}
... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/taxonomy-operations-sample-app-for-sharepoint |
7b0032df608d-0 | The ECM.RecordsManagement sample shows you how to use a provider-hosted add-in to control the in-place records management settings for a site or list.
Use this solution if you want to configure in-place records management settings during your custom site provisioning process.
Before you begin
To get started, down... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/records-management-extensions-sample-app-for-sharepoint |
7b0032df608d-1 | Scenario 1
Scenario 1 addresses in-place records management features and settings for sites. The add-in UI includes a Deactivate (or Activate ) button, as shown in the following figure. Choosing this button deactivates (or activates) the In-Place Records Management feature on the site collection.
The follow... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/records-management-extensions-sample-app-for-sharepoint |
7b0032df608d-2 | // Enable in-place records management in all locations.
site.SetManualRecordDeclarationInAllLocations(true);
// Set restrictions to default values after enablement (this is also done at feature activation).
EcmSiteRecordRestrictions restrictions = EcmSiteRecordRestrictions.BlockDelete | EcmSiteRecordRestrictions... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/records-management-extensions-sample-app-for-sharepoint |
7b0032df608d-3 | if (restrictions.Has(EcmSiteRecordRestrictions.None))
{
restrictionsProperty = EcmSiteRecordRestrictions.None.ToString();
}
else if (restrictions.Has(EcmSiteRecordRestrictions.BlockEdit))
{
// BlockEdit is always used in conjunction with BlockDelete.
restrictionsProperty = EcmSiteRecordRestrictions.... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/records-management-extensions-sample-app-for-sharepoint |
7b0032df608d-4 | // Refresh the settings as AutoDeclare changes the manual settings.
if (ipr.IsListRecordSettingDefined())
{
rdListAvailability.SelectedValue = Convert.ToString((int)ipr.GetListManualRecordDeclaration());
chbAutoDeclare.Checked = ipr.GetListAutoRecordDeclaration();
rdListAvailability.Enabled = !chbAutoDe... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/records-management-extensions-sample-app-for-sharepoint |
7b0032df608d-5 | list.SetPropertyBagValue(ECM_ALLOW_MANUAL_DECLARATION, true.ToString());
// Set the property that dictates custom list record settings to true.
list.SetPropertyBagValue(ECM_IPR_LIST_USE_LIST_SPECIFIC, true.ToString());
}
else if (settings == EcmListManualRecordDeclaration.NeverAllowManualDeclaration)
{
... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/records-management-extensions-sample-app-for-sharepoint |
7b0032df608d-6 | public static void SetListAutoRecordDeclaration(this List list, bool autoDeclareRecords)
{
// Determine the SharePoint version based on the loaded CSOM library.
Assembly asm = Assembly.GetAssembly(typeof(Microsoft.SharePoint.Client.Site));
int sharePointVersion = asm.GetName().Version.Major;
if (autoDeclareRec... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/records-management-extensions-sample-app-for-sharepoint |
7b0032df608d-7 | // ItemUpdating receiver.
EventReceiverDefinitionCreationInformation newEventReceiver = CreateECMRecordEventReceiverDefinition(EventReceiverType.ItemUpdating, 1000, sharePointVersion);
if (!ContainsECMRecordEventReceiver(newEventReceiver, currentEventReceivers))
{
list.EventReceivers.Add(newEventRecei... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/records-management-extensions-sample-app-for-sharepoint |
7b0032df608d-8 | {
list.EventReceivers.Add(newEventReceiver);
eventReceiverAdded = true;
}
// ItemCheckedIn receiver.
newEventReceiver = CreateECMRecordEventReceiverDefinition(EventReceiverType.ItemCheckedIn, 1006, sharePointVersion);
if (!ContainsECMRecordEventReceiver(newEventReceiver, currentEventReceiver... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/records-management-extensions-sample-app-for-sharepoint |
7b0032df608d-9 | if (eventReceiverAdded)
{
list.Update();
list.Context.ExecuteQuery();
}
// Set the property that dictates the autodeclaration.
list.SetPropertyBagValue(ECM_AUTO_DECLARE_RECORDS, autoDeclareRecords.ToString());
}
else
{
// Set the property that dictates the autodeclaration.
lis... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/records-management-extensions-sample-app-for-sharepoint |
fb817b454574-0 | The Core.InformationManagement sample shows you how to use an ASP.NET provider-hosted add-in to get and set a site policy on a site.
Use this solution if you want to:
Apply policy settings during your custom site provisioning process.
Create a new or modify an existing site policy.
Create a custom expiration ... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/information-management-sample-app-for-sharepoint |
fb817b454574-1 | The following code in the Page_Load method of the Default.aspx.cs page fetches and displays the closure and expiration dates of the site, based on the applied site policy. This code calls the GetSiteExpirationDate and GetSiteCloseDate extension methods of the OfficeDevPnP.Core project.
// Get site expiration an... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/information-management-sample-app-for-sharepoint |
fb817b454574-2 | The following code in the Page_Load method of the Default.aspx.cs page displays the names of all site policies that can be applied to the site (including the currently applied site policy). This code calls the GetSitePolicies extension method of the OfficeDevPnP.Core project.
// List the defined policies.
List<Si... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/information-management-sample-app-for-sharepoint |
fb817b454574-3 | The following code in the Default.aspx.cs page applies the selected site policy to the site. The original site policy is replaced by the new site policy.
protected void btnApplyPolicy_Click(object sender, EventArgs e)
{
if (drlPolicies.SelectedItem != null)
{
cc.Web.ApplySitePolicy(drlPoli... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/information-management-sample-app-for-sharepoint |
58099b1deb77-0 | The ECM.AutoTagging sample shows you how to use a provider-hosted add-in to automatically tag content added to a SharePoint library with data sourced from a custom user profile property.
This add-in uses remote event receivers, hosted on an Azure website, to:
Create fields, content types, and document libraries. ... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/autotagging-sample-app-for-sharepoint |
58099b1deb77-1 | <AppPermissionRequest Scope="http://sharepoint/taxonomy" Right="Read" />
<AppPermissionRequest Scope="http://sharepoint/social/tenant" Right="Read" />
</AppPermissionRequests>
In the ECM.AutoTaggingWeb project, in the ReceiverHelper.cs file, in the CreateEventReciever method, update the ReceiverUrl p... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/autotagging-sample-app-for-sharepoint |
58099b1deb77-2 | EventReceiverDefinitionCreationInformation _rer = new EventReceiverDefinitionCreationInformation();
_rer.EventType = type;
_rer.ReceiverName = receiverName;
_rer.ReceiverClass = "ECM.AutoTaggingWeb.Services.AutoTaggingService";
_rer.ReceiverUrl = "https://<Your domain... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/autotagging-sample-app-for-sharepoint |
58099b1deb77-3 | Package and deploy your add-in.
When you start the add-in, the start page of the Document Autotagging provider-hosted add-in displays, as shown in the following figure. The start page shows some additional configuration steps that you need to perform before you assign or remove the event receivers.
Using the ... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/autotagging-sample-app-for-sharepoint |
58099b1deb77-4 | Creates the remote event receiver for the ItemAdding event.
Note
This article discusses the ItemAdding event receiver type. Generally, the ItemAdding event receiver type performs better than the ItemAdded event receiver type. The ECM.AutoTagging sample provides code for both the ItemAdding and ItemAdded event rec... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/autotagging-sample-app-for-sharepoint |
58099b1deb77-5 | }
}
}
A call is made to the CreateContosoDocumentLibrary method. The following code in the ScenarioHandler.cs file uses methods from OfficeDevPnP.Core to create a custom document library with a custom content type. The default content type in the document library is removed.
public void C... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/autotagging-sample-app-for-sharepoint |
58099b1deb77-6 | if (library.VerisioningEnabled)
{
_list.EnableVersioning = true;
}
_list.ContentTypesEnabled = true;
_list.RemoveContentTypeByName("Document");
_list.Update();
ctx.Web.AddContentTy... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/autotagging-sample-app-for-sharepoint |
58099b1deb77-7 | The following code from the AddEventReceiver method assigns the remote event receiver to the document library.
public static void AddEventReceiver(ClientContext ctx, List list, EventReceiverDefinitionCreationInformation eventReceiverInfo)
{
if (!DoesEventReceiverExistByName(ctx, list, eventRecei... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/autotagging-sample-app-for-sharepoint |
58099b1deb77-8 | Now the remote event receiver is added to the document library. When you upload a document to the AutoTaggingSampleItemAdding document library, the document is tagged with the value of the Classification custom user profile property for that user.
The following figure shows how to view the properties on a document.... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/autotagging-sample-app-for-sharepoint |
58099b1deb77-9 | > [!IMPORTANT]
> After retrieving the **Classification** value from the **GetProfilePropertyFor** method, the **Classification** value must be formatted in a certain way before it can be stored as metadata on the document. The **GetTaxonomyFormat** method in the AutoTaggingHelper.cs file shows how to format the **Clas... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/autotagging-sample-app-for-sharepoint |
58099b1deb77-10 | return _result;
}
Remove Event Scenario 1 button
When you choose the button Remove Event Scenario 1 , the following code runs to remove the event receiver from the document library.
public static void RemoveEventReceiver(ClientContext ctx, List list, string receiverName)
{
ctx.Load(... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/autotagging-sample-app-for-sharepoint |
4ecdbf3d04f9-0 | The ECM.DocumentLibraries sample shows you how to use a provider-hosted add-in to create a list or document library, assign a content type to it, and remove the default content type.
Use this solution if you want to:
Create a list or document library and apply a default content type.
Assert greater control over... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/document-library-templates-sample-app-for-sharepoint |
4ecdbf3d04f9-1 | Using the ECM.DocumentLibraries sample add-in
When you start this add-in, the start page displays as shown the following figure. The ECM.DocumentLibraries start page looks like the page to add a new document library when you select Site Contents > Add an app > Document Library > Advanced Options , with one dif... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/document-library-templates-sample-app-for-sharepoint |
4ecdbf3d04f9-2 | The CreateContosoDocumentLibrary method then performs the following tasks, as shown in the next code example:
Creates custom fields in the Managed Metadata Service.
Creates a content type.
Associates the custom fields with the content types.
Creates the document library with the content type.
pu... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/document-library-templates-sample-app-for-sharepoint |
4ecdbf3d04f9-3 | CreateContosoDocumentLibrary calls the CreateTaxonomyField method, which is part of the OfficeDevPnP.Core. CreateTaxonomyField creates a field in the managed metadata service from the provider-hosted add-in.
public static Field CreateTaxonomyField(this Web web, Guid id, string internalName, string displayName, s... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/document-library-templates-sample-app-for-sharepoint |
4ecdbf3d04f9-4 | }
}
CreateContosoDocumentLibrary calls the CreateContentType method, which is part of OfficeDevPnP.Core. CreateContentType creates a new content type.
public static ContentType CreateContentType(this Web web, string name, string description, string id, string group, ContentType parentContentType = null)
... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/document-library-templates-sample-app-for-sharepoint |
4ecdbf3d04f9-5 | // Get field.
Field fld = web.Fields.GetById(new Guid(fieldID));
// Add field association to content type.
AddFieldToContentType(web, ct, fld, required, hidden);
}
CreateContosoDocumentLibrary calls the CreateLibrary method in ContentTypeManager.cs to create the docu... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/document-library-templates-sample-app-for-sharepoint |
4ecdbf3d04f9-6 | _list.ContentTypesEnabled = true;
_list.Update();
ctx.Web.AddContentTypeToListById(library.Title, associateContentTypeID, true);
// Remove the default Document Content Type.
_list.RemoveContentTypeByName(ContentTypeManager.DEFAULT_DOCUMENT_CT_NAME);
... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/document-library-templates-sample-app-for-sharepoint |
505440081133-0 | The Enterprise Content Management (ECM) solution pack includes code samples and documentation that you can use to transition your SharePoint Online and SharePoint ECM solutions from full trust code to the add-in model.
The samples in this solution pack show you how to use provider-hosted add-ins to perform common E... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/enterprise-content-management-solutions-for-sharepoint |
505440081133-1 | Support % and # in files and folders with ResourcePath API
-
Find developer guidance on updated support for % and # in files and folders.
See also
Office 365 Developer Patterns and Practices on GitHub
Office 365 development and SharePoint PnP solution guidance | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/enterprise-content-management-solutions-for-sharepoint |
7515854a460b-0 | You can use the SharePoint Add-in model to create and deploy workflows that run on either the add-in web or the host web. These workflows can interact with the remotely hosted portions of provider-hosted add-ins.
The workflows can also call remote web services that contain important business data in one of two ways: ... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/call-web-services-from-sharepoint-workflows |
7515854a460b-1 | Call custom web services from a workflow
The Workflow.CallCustomService sample shows you how to create a workflow that calls a custom web service that updates SharePoint list data. It also shows you how to design a provider-hosted add-in so that it queries a web service by using the remotely hosted web application th... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/call-web-services-from-sharepoint-workflows |
7515854a460b-2 | Create method
public ActionResult Create(string country, string spHostUrl)
{
var spContext = SharePointContextProvider.Current.GetSharePointContext(HttpContext);
using (var clientContext = spContext.CreateUserClientContextForSPAppWeb())
{
var service = new P... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/call-web-services-from-sharepoint-workflows |
7515854a460b-3 | return RedirectToAction("Details", new { id = id.Value, SPHostUrl = spHostUrl });
}
}
Add method
public int Add(string country)
{
var item = list.AddItem(new ListItemCreationInformation());
item["Country"] = country;
item.Update();
clie... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/call-web-services-from-sharepoint-workflows |
7515854a460b-4 | The StartWorkflow method then creates a workflow instance and passes the three values (appWebUrl, webServiceUrl, contextToken) stored in the payload variable to the workflow.
{
var workflowServicesManager = new WorkflowServicesManager(clientContext, clientContext.Web);
var subscriptionServ... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/call-web-services-from-sharepoint-workflows |
7515854a460b-5 | The UpdateSuppliers method then updates the Suppliers field of the newly added list item.
private void UpdateSuppliers(string country, string[] supplierNames)
{
var request = HttpContext.Current.Request;
var authority = request.Url.Authority;
var spAppWebUrl = request.H... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/call-web-services-from-sharepoint-workflows |
7515854a460b-6 | If you look at the design view of the workflow.xaml file in the Approve Suppliers directory of the add-in project, you see (by choosing the Arguments tab at the bottom left of the design view) that the workflow stores the three values in the payload variable that is passed to it as workflow arguments.
The Http... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/call-web-services-from-sharepoint-workflows |
7515854a460b-7 | The sample shows a task that is useful when you want to encapsulate all the interactions with a web service so that they are handled directly by the workflow. Using the web proxy makes it easier to update the remote web application logic without having to update the workflow instance. If you're not using the proxy and ... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/call-web-services-from-sharepoint-workflows |
7515854a460b-8 | Create method
public ActionResult Create(string country, string spHostUrl)
{
var spContext = SharePointContextProvider.Current.GetSharePointContext(HttpContext);
using (var clientContext = spContext.CreateUserClientContextForSPAppWeb())
{
var service = new P... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/call-web-services-from-sharepoint-workflows |
7515854a460b-9 | return RedirectToAction("Details", new { id = id.Value, SPHostUrl = spHostUrl });
}
}
Add method
public int Add(string country)
{
var item = list.AddItem(new ListItemCreationInformation());
item["Country"] = country;
item.Update();
clie... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/call-web-services-from-sharepoint-workflows |
7515854a460b-10 | TempData["Message"] = "Workflow Successfully Started!";
return RedirectToAction("Details", new { id = id, SPHostUrl = spHostUrl });
}
The StartWorkflow method creates a workflow instance and passes the two values (appWebUrl and webServiceUrl) stored in the payload variable to the workflow.
... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/call-web-services-from-sharepoint-workflows |
7515854a460b-11 | After the workflow starts, it makes a POST HTTP request that contains the suppliers list to the remotely hosted web application via the proxy. It does this via an HttpSend activity that queries the web proxy URL: appWebUrl + "/_api/SP.WebProxy.invoke" .
The workflow then passes the supplier list that it received... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/call-web-services-from-sharepoint-workflows |
7515854a460b-12 | public void Post(UpdatePartSupplierModel model)
{
var request = HttpContext.Current.Request;
var authority = request.Url.Authority;
var spAppWebUrl = request.Headers["SPAppWebUrl"];
var accessToken = request.Headers["X-SP-AccessToken"]; | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/call-web-services-from-sharepoint-workflows |
7515854a460b-13 | using (var clientContext = TokenHelper.GetClientContextWithContextToken(spAppWebUrl, accessToken, authority))
{
var service = new PartSuppliersService(clientContext);
service.UpdateSuppliers(model.Id, model.Suppliers.Select(s => s.CompanyName));
}
}
... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/call-web-services-from-sharepoint-workflows |
7515854a460b-14 | If the workflow is approved, it changes the value of the isApproved field of the list item to true .
Associate a workflow with the host web
The Workflow.AssociateToHostWeb sample shows you how to deploy a workflow to the host web and associate it with a list on the host web by using tools in Visual Studio. T... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/call-web-services-from-sharepoint-workflows |
7515854a460b-15 | When you choose Package the app , Visual Studio creates a Workflow.AssociateToHostWeb.app file in the bin\Debug\app.publish\1.0.0.0 directory of your solution. This .app file is a type of .zip file.
Extract the contents of the file by first changing the file extension to .zip.
In the directory that you've e... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/call-web-services-from-sharepoint-workflows |
7515854a460b-16 | You have now deployed the workflow to the host web and associated it with a list on the host web. You can trigger a workflow manually, or you can update the workflow in Visual Studio so that it is triggered in other ways.
See also
Composite business SharePoint Add-ins | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/call-web-services-from-sharepoint-workflows |
50d180c6ac3c-0 | The BusinessApps.CorporateEventsApp sample shows you how to implement a centralized corporate events management system as a provider-hosted add-in that integrates with your existing line-of-business (LOB) applications.
More specifically, the BusinessApps.CorporateEventsApp sample shows you how to implement an ASP.N... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/corporate-app-event-registration-with-sharepoint |
50d180c6ac3c-1 | Each web part contains links to each of the displayed events, where you can see the event details. When you choose a link, the event details page runs separately on the remote host, as shown in the following figure. You can choose Back to Site on the page to return to the SharePoint site and register for the event.
... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/corporate-app-event-registration-with-sharepoint |
50d180c6ac3c-2 | File webPartPage = web.GetFileByServerRelativeUrl(serverRelativeUrl);
if (webPartPage == null) {
return;
}
web.Context.Load(webPartPage);
web.Context.Load(webPartPage.ListItemAllFields);
web.Context.Load(web.RootFolder);
web.Conte... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/corporate-app-event-registration-with-sharepoint |
50d180c6ac3c-3 | The Models\DataInitializer.cs file also defines the XML for both web parts that are displayed on the new welcome page and then adds each one to the page. The following examples show how this works for the Featured Events web part.
Define web part XML
var webPart1 = new WebPartEntity(){
W... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/corporate-app-event-registration-with-sharepoint |
50d180c6ac3c-4 | <property name='WebPartName' type='string'>FeaturedEvents</property>
<property name='ProductId' type='System.Guid, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'>3a6d7f41-2de8-4e69-b4b4-0325bd56b32b</property>
<property name='ChromeState' type='chromestate'>Normal</property... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/corporate-app-event-registration-with-sharepoint |
50d180c6ac3c-5 | Add the web parts to the page
var limitedWebPartManager = webPartPage.GetLimitedWebPartManager(Microsoft.SharePoint.Client.WebParts.PersonalizationScope.Shared);
web.Context.Load(limitedWebPartManager.WebParts);
web.Context.ExecuteQuery();
for (var i = 0; i < limitedWebPartManager.Web... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/corporate-app-event-registration-with-sharepoint |
50d180c6ac3c-6 | In the Models directory of your web project, you'll notice that this MVC ASP.NET web application contains four class names that correspond to the lists and content types that the add-in installed:
Event.cs (Corporate Events)
Registration.cs (Event Registration)
Session.cs (Event Sessions)
Speaker.cs (Event Sp... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/corporate-app-event-registration-with-sharepoint |
50d180c6ac3c-7 | Gets the title of the list (case-sensitive).
The following table lists the methods that have to be implemented by the classes that inherit from the BaseListItem abstract class. These methods return parameters that should be set to blittable types so that they can be used on multiple platforms.
Met... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/corporate-app-event-registration-with-sharepoint |
50d180c6ac3c-8 | BaseGetEnum(ListItem item, string internalName, T defaultValue)
Gets the value of the enum property defined by the internalName parameter. Returns the value of the defaultValue parameter if the property is not set.
The Event.cs file contains the following implementations of the ReadProperties and Set... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/corporate-app-event-registration-with-sharepoint |
50d180c6ac3c-9 | if (imageUrl != null)
ImageUrl = imageUrl.Url;
}
SetProperties
protected override void SetProperties(ListItem item) {
BaseSet(item, FIELD_REGISTERED_EVENT_ID, RegisteredEventId);
BaseSet(item, FIELD_DESCRIPTION, Description);
BaseSet(item, FIELD... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/corporate-app-event-registration-with-sharepoint |
50d180c6ac3c-10 | if (field is FieldUrl && value is string) {
var urlValue = new FieldUrlValue() {
Url = value.ToString()
};
value = urlValue;
}
}
item[internalName] = value;
}
The BaseListIte... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/corporate-app-event-registration-with-sharepoint |
50d180c6ac3c-11 | ListItem.Update();
// Execute the batch.
context.ExecuteQuery();
// Reload the properties.
ListItem.RefreshLoad();
UpdateBaseProperties(ListItem);
ReadProperties(ListItem);
}
See also
Provisioning.Pages sample
OfficeDevPnP.Core ... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/corporate-app-event-registration-with-sharepoint |
8059f6e588ab-0 | This article describes the Core.DataStorageModels sample app, which shows you each of the following data storage options and the advantages and disadvantages of each:
SharePoint list on the add-in web
SharePoint list on the host web
External web service
Azure Table storage
Azure Queue storage
Azure SQL ... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/data-storage-options-in-sharepoint-online |
8059f6e588ab-1 | The first two scenarios let you retrieve data by using relatively simple client object model code or REST queries, but are limited by list query thresholds. The next four scenarios use different types of remote storage.
Data storage models start page prompting you to deploy SharePoint components
Before you begin ... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/data-storage-options-in-sharepoint-online |
8059f6e588ab-2 | In the Object Explorer , open the shortcut menu for (right-click) the Northwind database, select Tasks , and then select Deploy Database to SQL Azure .
On the Introduction screen, choose Next .
Choose Connect , and then enter the Server name for the Azure SQL Database server you just created.
In ... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/data-storage-options-in-sharepoint-online |
8059f6e588ab-3 | <add name="NorthWindEntities"
connectionString="metadata=res://*/Northwind.csdl|res://*/Northwind.ssdl|res://*/Northwind.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=<Your Server Here>.database.windows.net;initial catalog=NorthWind;user id=<Your Username Here>@<Your Server Here... | https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/data-storage-options-in-sharepoint-online |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.