Tuesday, March 15, 2016

Remove all custom user action

On my current project I use the PnP framework provisioning to add custom user action to my web. The web gets quickly fell up the custom user action weird places and it is hard to see which of the custom user action is the latest and therefore the ones I should test. Therefore, I use this PowerShell snippet to delete all, before I re-run my provisioning.

$web = get-spweb https://apps.dev2.net/sites/dev1/
$customActionIds = $web.UserCustomActions | select id
$customActionIds | % {
  $web.UserCustomActions.Item($_.Id).Delete()
}

Monday, February 29, 2016

Office 365 Saturday update

With less than two weeks to Office 365 Saturday event, Saturday, March 12. And with a fully packed schedule on the latest trends for SharePoint, Azure Power BI, Power App, Governance and CRM. As well as with a good opportunity to network with both Danish and international persons. It will be an exciting day. Therefore, we are looking forward to seeing you We therefore look very much to see you. Tickets are still available and we suggest you to invite others in your network to join in on the day. There are still tricks back and therefore an invitation to invite others in your network to join in the day.

Read more about the event and register here http://spsevents.org/city/Copenhagen/Copenhagen2016/

Saturday, January 16, 2016

New event in the Danish SharePoint community Office 365 Saturday

A new event in the Danish SharePoint community has been posted on the user group website. Read more about SharePoint Bruger Gruppe (SPBG): Møder at http://ift.tt/1RWbLCQ

Wednesday, January 13, 2016

The preview is here, Remote Desktop with support for Continuum

I’m a big Windows 10 mobile fan. No doubt about that and the idea behind Continuum really make me excited. I believe Continuum will change the way I work. But the one app I was missing was Remote Desktop with support for Continuum. The wait is over Microsoft has released, a preview version of Remote Desktop with support for Continuum. Read windowscentral.com article about here and download the new preview version here

Monday, December 21, 2015

Upload content type template throgh CSOM

A few years ago I bloged, read it there, on how through server site code could upload new content types templates. This snippet of code do it through CSOM.
1 string targetUrl = ""; 2 string username = ""; 3 string password = ""; 4 string contentTypeId = "0x01010043A8F0AB23DEB745AF7BF9D49A69F638"; 5 string templatePath = ""; 6 7 using (ClientContext clientContext = new ClientContext(targetUrl)) 8 { 9 SecureString pwd = new SecureString(); 10 foreach (char c in password.ToCharArray()) pwd.AppendChar(c); 11 12 //clientContext.Credentials = new NetworkCredential(username, pwd); 13 clientContext.Credentials = new SharePointOnlineCredentials(username, pwd); 14 clientContext.RequestTimeout = Timeout.Infinite; 15 16 FileInfo file = new FileInfo(templatePath); 17 18 ContentType contentType = clientContext.Web.ContentTypes.GetById(contentTypeId); 19 Web web = clientContext.Web; 20 21 clientContext.Load(contentType, c => c.Name); 22 clientContext.Load(web, w => w.ServerRelativeUrl); 23 clientContext.ExecuteQuery(); 24 25 string resourcePath = string.Format("{0}_cts/{1}", web.ServerRelativeUrl, contentType.Name); 26 27 using (FileStream stream = file.OpenRead()) 28 { 29 30 FileCreationInformation templateFile = new FileCreationInformation() 31 { 32 ContentStream = stream, 33 Url = file.Name, 34 Overwrite = true 35 }; 36 37 Folder folder = web.GetFolderByServerRelativeUrl(resourcePath); 38 folder.Files.Add(templateFile); 39 contentType.DocumentTemplate = file.Name; 40 contentType.Update(false); 41 clientContext.ExecuteQuery(); 42 } 43 }