View changeTitle.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var updateMetadata = | |
String.Format("_api/web/lists/getByTitle(@TargetLibrary)/RootFolder/folders(@TargetFolderName)/files/getbyurl(url=@TargetFileName)/listitemallfields?" + | |
"@TargetLibrary='{0}'&@TargetFolderName='{1}'&@TargetFileName='{2}'", docLibName, folderName, fileName); | |
//2. Update title metadata field. | |
//prep rest call | |
url = new Uri(String.Format("{0}{1}", SpoAuthUtility.Current.SiteUrl, updateMetadata)); | |
Console.WriteLine("\nREST Call updateMetadata: {0}\n\n", url); | |
//prep metadata changes. |
View readAndUpload.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//read file | |
Console.Write("Enter file path: "); | |
var filePath = Console.ReadLine(); | |
filePath = String.IsNullOrEmpty(filePath) ? "C:\\Users\\Sander\\Desktop\\test.docx" : filePath; | |
var byteArray = File.ReadAllBytes(filePath); | |
//prep REST endpoint | |
var addFileInFolder = | |
String.Format("_api/web/lists/getByTitle(@TargetLibrary)/RootFolder/folders(@TargetFolderName)/files/add(url=@TargetFileName,overwrite='{3}')?" + | |
"@TargetLibrary='{0}'&@TargetFolderName='{1}'&@TargetFileName='{2}'",docLibName, folderName, fileName, true); |
View CreateAzureServiceBus.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add-AzureAccount | |
New-AzureSBNamespace -Name "Your namespace name" - Location "your location" |
View Add ListViewWebPart to wiki page and adapt view.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public SPRemoteEventResult ProcessEvent(SPRemoteEventProperties properties) | |
{ | |
var result = new SPRemoteEventResult(); | |
using (var clientContext = TokenHelper.CreateRemoteEventReceiverClientContext(properties)) | |
{ | |
if (clientContext != null) | |
{ | |
try | |
{ |
View Add ListViewWebPart to wiki page.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public SPRemoteEventResult ProcessEvent(SPRemoteEventProperties properties) | |
{ | |
var result = new SPRemoteEventResult(); | |
// Get the token from the request header. Because this is a .svc remote event receiver we use the current Operationcontext. | |
var requestProperty = (HttpRequestMessageProperty)OperationContext.Current.IncomingMessageProperties[HttpRequestMessageProperty.Name]; | |
var contextToken = TokenHelper.ReadAndValidateContextToken(requestProperty.Headers["X-SP-ContextToken"], requestProperty.Headers[HttpRequestHeader.Host]); | |
using (var clientContext = TokenHelper.CreateRemoteEventReceiverClientContext(properties)) | |
{ |
View AppManifest.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<!--Created:cb85b80c-f585-40ff-8bfc-12ff4d0e34a9--> | |
<App xmlns="http://schemas.microsoft.com/sharepoint/2012/app/manifest" Name="YourAppName" ProductID="{6b1a2b10-c511-4484-a0f2-d8d247e1c3e7}" Version="1.6.0.8" SharePointMinVersion="15.0.0.0"> | |
<Properties> | |
<Title>YourAppName</Title> | |
<StartPage>https://localhost:44303/Pages/Default.aspx?{StandardTokens}&SPHostTitle={HostTitle}</StartPage> | |
<UpgradedEventEndpoint>https://YourServiceBus.servicebus.windows.net/3458491647/3050950848/obj/f44563bb-02a0-4a5b-b2da-737023b5a03e/Services/AppEventReceiver.svc</UpgradedEventEndpoint> | |
<InstalledEventEndpoint>https://YourServiceBus.servicebus.windows.net/3458491647/3050950848/obj/f44563bb-02a0-4a5b-b2da-737023b5a03e/Services/AppEventReceiver.svc</InstalledEventEndpoint> | |
</Properties> | |
<AppPrincipal> |
View create list and bind remote event receiver.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//do not forget to reference officeams.core (http://officeams.codeplex.com) dll to call extension methods. | |
//create settingslist | |
hostWebClientContext.Web.AddList(100, new Guid("00bfea71-de22-43b2-a848-c05709900100"), "Settings", false); | |
//get settings list | |
var settingsList = hostWebClientContext.Web.GetListByTitle("Settings"); | |
//prepare eventreceiver binding | |
var eventReceivers = settingsList.EventReceivers; |
View CSOM_CopyFile.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function copyFile(targetSiteUrl, contextId, targetFileName, targetList) { | |
//get current search result item | |
var currentItem = window.ctxData[contextId]; | |
// Create a request executor. | |
var sourceExecutor = new SP.RequestExecutor(currentItem.SPSiteUrl); | |
var targetExecutor = new SP.RequestExecutor(targetSiteUrl); | |
// Get the absolute server url. | |
var serverUrlRegex = new RegExp(/http(s?):\/\/([\w]+\.){1}([\w]+\.?)+/); |