Office 365 – Updating Content Type “DocumentTemplate” property using PowerShell

Welcome back to my blog.

Today I came across one query from the forum for updating the Content Type’s “DocumentTemplate” URL.  Here is the PowerShell Script to update the same.

PowerShell script uses Client Side Object Model to update the content type property.

 

Please change required in the script is specify the SharePoint Online URL, Content Type Name and DocumentTemplate URL.

cls
#Import SharePoint Online Management Shell
Import-Module Microsoft.Online.SharePoint.Powershell -ErrorAction SilentlyContinue
Add-PSSnapIn Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
#region Input Variables

$SiteUrl = “https://xxx.sharepoint.com/sites/dev” #Replace the URL

$UserName = Read-Host -Prompt “Enter User Name”
$SecurePassword = Read-Host -Prompt “Enter password” -AsSecureString
$cred = New-Object -TypeName System.Management.Automation.PSCredential -argumentlist $UserName, $SecurePassword
#endregion
#region Connect to SharePoint Online tenant and Create Context using CSOM
Try
{
#region Load SharePoint Client Assemblies
Add-Type -Path “C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.dll”
Add-Type -Path “C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.Runtime.dll”
Add-Type -Path “C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\ISAPI\Microsoft.SharePoint.Client.WorkflowServices.dll”
#endregion
#region connect/authenticate to SharePoint Online and get ClientContext object..
$clientContext = New-Object Microsoft.SharePoint.Client.ClientContext($SiteUrl)
$credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($UserName, $SecurePassword)
$clientContext.Credentials = $credentials
Write-Host “Connected to SharePoint Online site: ” $SiteUrl -ForegroundColor Green
Write-Host “”
#endregion
}
Catch
{
$SPOConnectionException = $_.Exception.Message
Write-Host “”
Write-Host “Error:” $SPOConnectionException -ForegroundColor Red
Write-Host “”
Break
}
#endregion
if (!$clientContext.ServerObjectIsNull.Value)
{
$web = $clientContext.Web
$cts = $web.ContentTypes
$clientContext.Load($cts);
$clientContext.ExecuteQuery();

foreach ($ctype in $cts)
{
if($ctype.Name -eq “TestCT”) #Specify the Content Type Name
{

$ctype.DocumentTemplate = “” #specify the URL
$ctype.Update($true); #updates all children of the content type
$clientContext.Load($ctype);
$clientContext.ExecuteQuery();
Write-Host $ctype.Name “-” $ctype.DocumentTemplate
}
}

}

You can also download PowerShell Script

Posted in SharePoint 2013 | Leave a comment

Speaking @SPBangalore 4th Event – Working with Apps in SharePoint 2013 / Office 365

I am speaking at 4th in-person Event of SPBangalore.  The event is about SharePoint 2013 Apps (Introduction to App, SharePoint Hosted, Provider Hosted Apps & Office Apps: One Note & Excel App on Android and iPad).

Those who are in Bangalore, INDIA can register to this event using the following link

Working with Apps in SharePoint 2013 / Office 365

Posted in SharePoint 2013 | Leave a comment

Office 365 (SharePoint Online) Developer tenant free for 1 year

Office 365 Developer team announced a new Office 365 Developer Program for developers working with Office 365, SharePoint, the Office client… anything related to Office!

By signing up you get a Free Office 365 Developer Tenant! This is a free one-year Office 365 tenant.

Additionally Microsoft sends you monthly newsletter with all updates and training related information.

You can download the visual studio 2013 community edition which is absolutely free (equivalent to Visual studio 2013 professional edition) from the following link.

https://www.visualstudio.com/en-us/news/vs2013-community-vs.aspx

Posted in SharePoint 2013 | Leave a comment

Ignite 2015 Update: SharePoint Online Migration API Release

On May 5th  2015, Microsoft had released new API for SharePoint Online Migration to fast the migration process from SharePoint On-premises to SharePoint Online.

To use this API, all you need to have is AZURE Storage Account for storing your migration packages temporarily.

About Azure Storage Accounts

Steps

  • Create Package using API
  • Upload the package to azure blob storage
  • Use CSOM call to start the migration process, Azure queue gets real time updates
  • Once complete the logs in the package get updated

One thing you need to remember while using API is that you need have to structure ready at the destination.  Current version of API  migrate only data it does not migrate the structure like site creation, list creation, content type creation etc. And also this API does not support workflow associations.

Currently four third-party tools are supported this API.  This API gels very well with the third-party migration tool.  The third-party migration tool will create the structure required at the destination and utilizes this API for migration of data, in this way it will be faster your migrations.

Alternate approach is create custom tool in association with the SharePoint Online Migration API, for this type of scenario will have wait until Microsoft releases the original version.  Currently it is in beta program.

For more details, please refer to the nice blog.

What is the Office 365 Migration API

Ignite Video about SharePoint Online Migration API

Migration to SharePoint Online Best Practices and New API Investments

Posted in SharePoint 2013 | Leave a comment

Microsoft Ignite – SharePoint 2013 Sessions

Microsoft Ignite is starting from today, those who are not able to make in-person event. No worries, you can still watch the live sessions from the channel 9. Here is the link.

https://channel9.msdn.com/Events/Ignite/2015

Some of the interesting topics related to SharePoint 2013/Office 365 (SharePoint Online) are as follows

Office Development Matters, and Here’s Why…

You’ve seen the keynote announcing the new developer capabilities, in this kick off we delve deeper into all these announcements with demos and code. Understand what’s new in Office 365 development with the announcements this week. See the compelling business reasons to leverage these new approaches, and learn where to get started.

Monday, May 4th
01:30PM – 02:45PM

Deep Dive into Safe SharePoint Branding in Office 365 Using Repeatable Patterns and Practices

This session demonstrates how the use of repeatable, proven, and secure patterns and practices can help developers create a safe branding solution that they can implement in Microsoft Office 365.

Monday, May 4th
03:15PM – 04:30PM

Migration to SharePoint Online Best Practices and New API Investments

In this session we provide an overview of best practices to migrate Files Shares or on-premises SharePoint environment to SharePoint Online. First we will focus specifically on defining a holistic migration approach, the Content Migration Process, replacing full trust solutions, and addressing network capacity concerns. We will then talk about the new SharePoint Online Migration API in that area and what to expect out of it. This will be followed by more in depth explanation on how to fully take advantages of those new capability.

Tuesday, May 5th
10:45AM – 12:00PM

Building an App on top of the Office Graph

With Delve we have a first glimpse at how the most relevant content can be automatically surfaced to us using the Office Graph. In this session Paul Olenick (SP MVP) will share his journey of creating a custom Universal Windows App on the Graph with Cortana integration. He will walk attendees through the process including conception, design, dev and finally publishing the app. Attendees will learn about opportunities, limitations, helpful tools and considerations when working with the Graph.

The SharePoint Community

You are not an island, especially when it comes to being an IT professional or Developer working with SharePoint. A vibrant and friendly user community exists around the product and it’s there to help you. Come to this session to learn about all the different ways you can get support from and get involved in your SharePoint Community. This session will introduce you to SharePoint conferences , SharePoint Yammer networks, community user groups, key websites, forums & resources.

Tuesday, May 5th
11:35AM – 11:55AM

Building Business Apps Like They Do in the Valley with AngularJS, Node.js, and More

This session is a deep dive journey into using third party AngularJS, NodeJS, or any other third-party library to create apps.

Tuesday, May 5th
01:30PM – 02:45PM

Future-Proofing Your On-Premises SharePoint Development

Learn how to design and develop SharePoint apps and solutions in your on-premises environment, that will easily migrate to the cloud when your organization is ready.

Tuesday, May 5th
03:15PM – 04:30PM

Transforming Your SharePoint Full Trust Code to the Office App Model

This session is a panel discussion covering examples and patterns for moving SharePoint customizations to the app model – for use either in Office 365 or “cloud-friendly” implementations of on-premises SharePoint. The panel comprises members of the Microsoft Office Dev Patterns and Practices team and independent MVPs. Both bring their experiences from the field, but different perspectives too. The discussion will centre around 5 related hot topics – branding, options around remote code (including .NET, JavaScript and PowerShell), provisioning of customized sites, the story with sandbox solutions and finally how the Office 365 APIs fit in with the app model. We promise a lively discussion, examples of code from the field, and time for Q&A!

Tuesday, May 5th
05:00PM – 06:15PM

Setting Up Your On-Premises SharePoint Environment for Custom App Development

This session walks through the operations and management details of how to set up your development environment on-premises to develop cloud apps and solutions.

Wednesday, May 6th
03:15PM – 04:30PM

Authentication Patterns for SharePoint Server 2013, Office 365 and OneDrive for Business

Can single sign-on be accomplished with SharePoint? What about with Microsoft Office 365 and OneDrive for Business? How do I integrate my on-premises apps with the cloud in a secure manner? I need to authenticate devices, how can SharePoint help me? This session provides you with the positive options available for answering these and several other authentication questions. Learn about the different authentication options available for integrating systems apps, devices, and applications for on-premises scenarios, in the cloud and hybrid. Your given scenario dictates what is possible with SharePoint, Office 365, and everything in between. We help you identify those needs and implement them properly and effectively.

Wednesday, May 6th
05:00PM – 06:15PM

Office 365 Video and Custom Solutions Built on Azure Media Services

Azure Media Services enables creation of end-to-end media workflows with flexible and highly scalable encoding, packaging, and distribution services at its core. This session focuses on how Microsoft built Office 365 Video on top of

Azure Media Services, along with showcasing a number of non-Microsoft custom solutions leveraging this same, powerful backend.

Thursday, May 7th
09:00AM – 10:15AM

Dealing with Application Lifecycle Management in Microsoft Office 365 App Development

For teams doing cloud-friendly SharePoint or Office 365 development, apps will be a key area of focus – be they SharePoint add-ins or the newer Office 365/Azure AD apps. ASP.NET (typically MVC) is a common platform here, and fortunately

ALM and Continuous Integration become MUCH easier – finally, an end to “it’s harder because it’s SharePoint!” We’ll demonstrate how Visual Studio Online and Azure Web Apps are a winning combination for “continuous deployment”, and also

how features such as “Deployment Slots” in Azure can help with dev and test environments, and also the upgrade/push-to-live process. Several demos will ensure you’re covered for developing both SharePoint add-ins and Office 365 apps.

Thursday, May 7th
10:45AM – 12:00PM

Best Practices for Design and Performance in SharePoint Online

Are your SharePoint Online pages slow? Do you know how to diagnose and tune their performance? What about design? Are you aware of the possibilities with customer master pages, CSS, JavaScript, and more? Come for an in-depth presentation

on SharePoint Online page design and performance best practices. We take a look to understand what happens when pages get rendered, the do’s and don’ts of portal/page design, what factors contribute to bad performance, and even a look

behind the scenes of the service into how Microsoft tunes things in SharePoint Online to handle everything that you can throw at us.

Thursday, May 7th
10:45AM – 12:00PM

The Social Intranet: Integrate Yammer into Your Microsoft SharePoint Experience

Yammer is the standalone, end-to-end enterprise social platform for your organization. You can extend the social experience directly into your Microsoft Office 365 or on-premises SharePoint portal with a range of options from Yammer Embed to the REST API. We explore the ins and outs of Yammer integration, capabilities, terms of service, and governance for production applications. Learn how we can use Yammer methods as well as reference the powerful Office 365 dev patterns and practices. There are recommended dos and don’ts, which we highlight with relevant real-world case studies. We cover effective design for enhanced user experience and engagement, making your Portal and Yammer a seamless experience to increase usage and adoption.

Thursday, May 7th
01:30PM – 02:45PM

Search Extensibility in SharePoint 2013

Come on a tour of the common extensibility and development tasks needed to take advantage of the full power of SharePoint 2013 Search Service. Ingest content from external sources through the BCS. Enhance content prior to indexing via Content Enrichment. Pinpoint relevancy and enhance user queries through contextual targeting with Query Rules. Make the most of the new Keyword Query Language improvements. Finally, customize the end-user experience and make your search results shine!

Thursday, May 7th
05:00PM – 06:15PM

Yammer Mining: Dig in and “Listen” to What Your Big *Social* Data Is Saying

Mining social data has become a popular way for organizations to listen and react to employees in near real-time, real social insights. Come see how this can be applied inside your organization to strengthen employee connections, monitor employee sentiment, and accelerate social platform adoption. See mining techniques and Yammer apps for monitoring the social enterprise and leave with a better understanding of the big data and transaction velocity challenges of mining Yammer. We leverage new Power BI tools, dive into the administrative side of Yammer – including analytics. Bring your ax, there’s gold in them thar hills.

Friday, May 8th
09:00AM – 10:15AM

Developing Microsoft Office and SharePoint Solutions in a Hybrid World

Since the App Model was introduced with SharePoint 2013, the developer community has been busy building apps in the cloud and continuing on-premises development. In parallel, more companies are establishing hybrid deployments. This session highlights techniques and solutions to provide future-proofing of solutions and new hybrid techniques – enabling on-premises and cloud hosted deployments to work better together, beyond their respective silos. We show numerous demos and provide code samples highlighting best practices that help bridge the two worlds.

Friday, May 8th
09:00AM – 10:15AM

Posted in SharePoint 2013 | Leave a comment

SharePoint Migration Session by SPBangalore on 21st March, 2015

SPBangalore group is doing their 3rd session related to SharePoint Migration on 21st March, 2015.  There will be two sessions related to migration  from SharePoint 2010 to 2013 and to cloud.  And also there will be one session of Lotus Notes migration to SharePoint 2013.

Those who are in Bangalore, INDIA can register for the event using the following link.

Migrations in SharePoint

Posted in SharePoint 2013 | Leave a comment

InfoPath 2013 alive till Next Version of SharePoint 2016.

One great news for InfoPath lovers that InfoPath Form Services are still supported in next version of SharePoint i.e. SharePoint 2016.  Microsoft has announced on Feb 6th 2015 as follows:

“As part of the update shared around the Evolution of SharePoint and the next SharePoint Server on-premises release, we are also updating the timelines for removal of InfoPath Forms Services components of SharePoint and SharePoint Online. Specifically, InfoPath Forms Services will be included in the next on-premises release of SharePoint Server 2016, as well as being fully supported in Office 365 until further notice. Customers will be able to confidently migrate to SharePoint Server 2016 knowing that their InfoPath forms will continue to work in their on-premises environments, as well as in Office 365.

The InfoPath 2013 application remains the last version to be released and will work with SharePoint Server 2016.”

For complete information, please refer to the following article.

InfoPath is back in SharePoint 2016 & FoSL vNext is dead!

Posted in SharePoint 2013 | Leave a comment

SPCAF (SharePoint Code Analysis Framework) tool for SharePoint 2013 Apps

SPCAF(SharePoint Code Analysis Framework) is a very handy and useful tool integrated with Visual Studio for keeping the code quality up and prevents the stability issues within the farm.

Please refer to the following link for complete review.

SPCAF Review

You can download the trial version from the following link

SharePoint Code Analysis Framework tool

Posted in SharePoint 2013 | Leave a comment

SharePoint Online (Office 365): Public site feature not available from Jan 2015

One bad news who are using SharePoint Online for public sites, the feature is going to drop from January 2015.  It is confirmed by Microsoft, please refer to the following post for more details.

Information about upcoming changes to the SharePoint Online Public Website

Microsoft  says that the current SharePoint Online public site feature was designed for customers to support only basic online presence.

Alternate option Microsoft suggesting is third-party solutions, which provide more robust tools for delivering, supporting fuller online presence.

 

Posted in SharePoint Online | Leave a comment

PowerShell script to create sub-sites with unique permission from the SharePoint List

Today, I came across one interesting question in the MSDN SharePoint forums on creating sub-sites from the list.

Scenario

User has list with four columns SiteName, Email, ManagerName, ManagerEmail as shown in the below screenshot.

SiteColumns

 

From the above List, user want to create the sub-sites with unique permissions, added Manager as user with Contribute permission.

Solution

PowerShell Script to access list and create sub-sites with unique permission.

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue
$sourceWebURL = "http://sp2013" #Replace with your site collection
$sourceListName = "MySites" #Replace with your List
$spSourceWeb = Get-SPWeb $sourceWebURL
$spSourceList = $spSourceWeb.Lists[$sourceListName]
$spSourceItems = $spSourceList.GetItems()
foreach($item in $spSourceItems)
{
$siteTitle = $item["Title"]
$siteName = $siteTitle -replace " ", ""
$NewSiteUrl = $sourceWebURL+"/"+$siteName
write-host "Title:"$siteTitle
write-host "Url:"$NewSiteUrl

#Create User Object from the List Item
$userWithContribute = New-Object Microsoft.SharePoint.SPFieldUserValue($spSourceWeb,$item["ManagerName"].ToString());

#Create Sub-site with Unique Permissions
$newWeb = New-SPWeb -Url $NewSiteUrl -Name $siteTitle -Template "STS#0" -UniquePermissions

#Assign Manager with Contribute permission
Set-SPUser -Identity $itemUser.User -Web $newWeb -AddPermissionLevel "Contribute"

}

Same can be downloaded from the Technet Gallery

Posted in SharePoint 2013 | Leave a comment