Run SharePoint Online cmdlets in an Azure Function App

Functions_LogoInterested in deploying your SharePoint PowerShell scripts to Azure? Stick ’em in an Azure Function App! All the perks of a scheduled job but with an optional HTTP endpoint for invocation.

To get the SPO cmdlets available there are a few things you need to do.

Continue reading “Run SharePoint Online cmdlets in an Azure Function App”

Updating List Column Names via CSOM

Looking to rename list columns programmatically? Couldn’t be easier:

// Site
string webUrl = "https://my-Site.sharepoint.com/";
// Username
string userName = "my.name@my-Site.onmicrosoft.com";
// Password
SecureString password = new SecureString();
password.AppendChar('P');
password.AppendChar('a');
password.AppendChar('s');
password.AppendChar('s');
password.AppendChar('w');
password.AppendChar('o');
password.AppendChar('r');
password.AppendChar('d');

// Running in context of our site
using (var context = new ClientContext(webUrl))
{
// Credentials
context.Credentials = new SharePointOnlineCredentials(userName, password);
// List name
List myList = context.Web.Lists.GetByTitle("Documents");
// Site column in particular
Field siteCol = myList.Fields.GetByTitle("Title");
// Give it a new name
siteCol.Title = "Document Name";
// Update the column
siteCol.Update();
// Update the list
myList.Update();
// Execute!
context.ExecuteQuery();

}

Populate SharePoint Hosted Add-In Lists with Data

I’ve been tinkering with a simple SharePoint Hosted Add-In the last few days that required an assets library to come pre-populated with a collection of images.

A quick google seemed to only return results that referred to lists so I thought I’d put something out there that covered both!

Continue reading “Populate SharePoint Hosted Add-In Lists with Data”

Both X and X contain a file that deploys to the same package location

Ran into this error today. It consumed an embarrassing amount of time to fix. I have been close to chucking computers out the window before, but today was a new record.

So for some reason when I tried to publish or deploy my SharePoint app project I was greeted with:

—— Build started: Project: AddinTest, Configuration: Debug Any CPU ——
C:\Users\[REDACTED]\Source\Workspaces\SharePoint Test App\AddinTest\AddinTest\Features\Feature1\Feature1.feature : error : The following file can not be found: “C:\Users\[REDACTED]\Source\Workspaces\SharePoint Test App\AddinTest\AddinTest\Content\bootstrap-datetimepicker-build.less”.
========== Build: 0 succeeded or up-to-date, 1 failed, 0 skipped ==========
========== Deploy: 0 succeeded, 0 failed, 0 skipped ==========

Continue reading “Both X and X contain a file that deploys to the same package location”