Unable to change Content Type of document in Library

I was trying to remove a content type from a document library which was associated with multiple content types. As a first action, I identified all documents tagged with the content type to be removed and tried to update them with another content type. However some documents were still showing the old content type despite saving it with the new content type by updating the [Content Type] field.

contenttypecolumn

I tried removing the document and adding the document back to the document library, unfortunately it was still referencing the old content type.

The solution that worked for me was to open the document in desktop office and open the “Advanced Properties”.

advancedproperties

Find and select the property ContentTypeId and click on Delete.

contenttypeiddelete

After deleting the ContentTypeId property I was able to update the content type property of the document and eventually remove the old content type from the document library.

Create Dev/Test SharePoint 2013 environment in Azure

Azure has a trial image to build either SharePoint 2013 HA farm or SharePoint 2013 Non-HA farm.

When trying to create SharePoint 2013 Non-HA farm, I was stuck at step “Choose storage account type” with the message “Loading pricing…”.

hangingselectstorageaccounttypefromazure

Following SharePoint Server 2016 dev/test environment in Azure, I managed to created a SharePoint 2013 environment in Azure running PowerShell commands.

There are three major phases to setting up this dev/test environment:

  1. Set up the virtual network and domain controller (ad2013VM).I followed all steps described in Phase 1: Deploy the virtual network and a domain controller to set up the virtual network and domain controller
  2. Configure the SQL Server computer (sql2012VM).I followed all steps from Phase 2: Add and configure a SQL Server 2014 virtual machine to create the SQL server computer with few changes to the PowerShell script to create a SQL2012R2 machine.
  3. Configure the SharePoint server (sp2013VM).                                                                               I followed all steps from Phase 3: Add and configure a SharePoint Server 2016 virtual machine with few changes to the script to create a SharePoint 2013 virtual machine.

Configure the SQL Server computer (sql2012VM).

I needed to get the name of SQL 2012 SP2 Azure image offer. I can list all SQL Azure image offers using the cmdlet Get-AzureRMImageOffer.

Get-AzureRmVMImageOffer -Location "westeurope" 
-PublisherName "MicrosoftSQlServer"

get-azurermimageoffersql

The following SQL Image Offers are available

Offer
-----
SQL2008R2SP3-WS2008R2SP1
SQL2008R2SP3-WS2012
SQL2012SP2-WS2012
SQL2012SP2-WS2012R2
SQL2012SP3-WS2012R2
SQL2012SP3-WS2012R2-BYOL
SQL2014-WS2012R2
SQL2014SP1-WS2012R2
SQL2014SP1-WS2012R2-BYOL
SQL2014SP2-WS2012R2
SQL2014SP2-WS2012R2-BYOL
SQL2016-WS2012R2
SQL2016-WS2012R2-BYOL
SQL2016-WS2016
SQL2016-WS2016-BYOL
SQL2016CTP3-WS2012R2
SQL2016CTP3.1-WS2012R2
SQL2016CTP3.2-WS2012R2
SQL2016RC3-WS2012R2v2
SQL2016SP1-WS2016
SQL2016SP1-WS2016-BYOL
SQLvNextRHEL

I was interested in SQL 2012 SP2 Standard version. Fortunately the Azure Image Offer Names are intuitive, e.g. Name SQL2012SP2-WS2012R2 means windows server 2012 R2 virtual machine with SQL Server 2012 SP2 installed.

I also needed the SKU value of the SQL 2012 SP2 using the cmdlet Get-AzureRmVMImageSKU

 Get-AzureRmVMImageSKU -Location "westeurope" -PublisherName "MicrosoftSQlServer" 
-Offer SQL2012SP2-WS2012R2|format-table Skus

The following SKUs for SQL2012SP2-WS2012R2 are available

Skus
----
Enterprise
Enterprise-Optimized-for-DW
Enterprise-Optimized-for-OLTP
Standard
Web

The changes from the original script are on the following lines

  • line 21: “sql2012VM” stored in variable $vmName
  • line 23: $vnet=Get-AzureRMVirtualNetwork -Name “SP2013Vnet” -ResourceGroupName $rgName
  • line 40 : $vm=Set-AzureRMVMSourceImage -VM $vm -PublisherName MicrosoftSQLServer -Offer SQL2012SP2-WS2012R2 -Skus Standard -Version “latest”

Configure the SharePoint server (sp2013VM).

Similarly to creating the SQL virtual machine, I needed the Azure Image Offer Name for SharePoint 2013.

The available SharePoint Azure Image offers for Microsoft SharePoint can be retrieved using the cmdlet below.

Get-AzureRmVMImageOffer -Location "westeurope" 
-PublisherName "MicrosoftSharePoint"

Only one result “MicrosoftSharePointServer” is returned.

To get the available SKUs for “MicrosoftSharePointServer”, the cmdlet below can be run.

 Get-AzureRmVMImageSKU -Location "westeurope" -PublisherName "MicrosoftSharePointServer" 
|format-table Skus

get-azurermimageoffersharepoint

Two results are returned : “2013” and “2016”. I am interested in the “2013” value which refers to the Microsoft SharePoint Server 2013 version.

The changes from the original script are on the following lines

  • line 18: $vmName=“sp2013VM”
  • line 26:$vnet=Get-AzureRMVirtualNetwork -Name “SP2013Vnet” -ResourceGroupName $rgName
  • line 34: $skuName=“2013”

The end result of the PowerShell scripts is a resource group with the virtual machines (adVm, sp2013Vm and sql2012VM), network interfaces, availability sets, storage account and public IP addresses to enable SharePoint 2013 to run in Azure VMs.

 

sharepoint2013resourcegroup

Import Configuration Data to CRM using Microsoft.Xrm.Data.PowerShell

CRM Dynamics data can be exported using the data migration tool by first generating the data schema file and using the later to export selected entities and fields. The same data migration tool can be used to import data into other environments. However it is still a manual process.

I have written a script using Microsoft.Xrm.Data.PowerShell module in PowerShell  to automate the data import. The zip generated by the export needs to be unzipped so that the path of the files can be passed to the method called to import the data.unzippedconfigfile

The script can be downloaded from TechNet gallery. Please note that the script has been tested with limited data so might require changes depending on the data being imported.

Call the method Import-ConfigData as in the snippet below.

 Add-type -Path ".\Assemblies\Microsoft.Xrm.Tooling.CrmConnectControl.dll"
 Add-Type -Path ".\Assemblies\Microsoft.Xrm.Tooling.Connector.dll"

import-module ".\Microsoft.Xrm.Data.PowerShell\Microsof t.Xrm.Data.PowerShell.psm1"

$crmOrg = New-Object `         
   -TypeName Microsoft.Xrm.Tooling.Connector.CrmServiceClient `         
   -ArgumentList ([System.Net.CredentialCache]::DefaultNetworkCredentials),             ([Microsoft.Xrm.Tooling.Connector.AuthenticationType]::AD) 
,            $serverName 
,            $serverPort 
,             $organizationName 
,             $False 
,            $False 
,           ([Microsoft.Xrm.Sdk.Discovery.OrganizationDetail]$null$dataFilePath =  "\PkgFolder\Configuration Data\data.xml" 
$dataSchemaFilePath = "\PkgFolder\Configuration Data\data_schema.xml" 
Write-Output "Begin import of configuration data..." 
Import-ConfigData -dataFilePath $dataFilePath 
-dataSchemaFilePath $dataSchemaFilePath -crmOrg $crmOrg 
Write-Output "End import of configuration data..."

First initialise the crm connection object of type Microsoft.Xrm.Tooling.Connector.CrmServiceClient stored in the variable $crmOrg above.

Pass the following parameters to the method.

datafilePath: Path of the file data.xml

crmOrg  : crm connection object

dataschemafilepath: Path of the file dataschema.xml

 

 

Create Virtual Machine(VM) in Azure throws “Long running operation failed with status ‘Failed’.” through PowerShell

I was following the article SharePoint Server 2016 dev/test environment in Azure to create a SharePoint Server 2016 environment in Azure.

I reached the step to create the Virtual Machine that will be used as the domain controller using the cmdlet below

New-AzureRMVM -ResourceGroupName $rgName -Location $locName -VM $vm

After waiting for several minutes I decided to cancel the operation. When I retried the same cmdlet, I got the following error.

New-AzureRMVM -ResourceGroupName $rgName -Location $locName -VM $vm -Verbose
VERBOSE: Performing the operation "New" on target "adVM".
New-AzureRMVM : Long running operation failed with status 'Failed'.
ErrorCode: VMAgentStatusCommunicationError
ErrorMessage: VM 'adVM' has not reported status for VM agent or extensions. 
Please verify the VM has a running VM agent, and can establish 
outbound connections to Azure storage.
StartTime: 18/11/2016 15:42:46
EndTime: 18/11/2016 15:42:46
OperationID: f1ecb302-9da9-4a76-9b0c-463b5e89c41c
Status: Failed
At line:1 char:1
+ New-AzureRMVM -ResourceGroupName $rgName -Location $locName -VM $vm -Verbose
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 + CategoryInfo : CloseError: (:) [New-AzureRmVM], ComputeCloudException
 + FullyQualifiedErrorId : Microsoft.Azure.Commands.Compute.NewAzureVMCommand

I spent a while trying to understand what the error message meant. In that scenerio the error message was thrown because the VM requested was created successfully even though I interrupted the operation before. The error thrown was to prevent creating another VM with the same details.

When I created the second VM, I waited long enough till the success message was displayed.

vmcreatedsuccessfully

Create Azure Virtual Network throws Error “Subscription is not registered with NRP”

I was following the article SharePoint Server 2016 dev/test environment in Azure to create a SharePoint Server 2016 environment in Azure.

I reached the step to create the SP2016Vnet Azure Virtual Network that will host the SP2016Subnet subnet.

I tried  the cmdlets below

$spSubnet=New-AzureRMVirtualNetworkSubnetConfig -Name SP2016Subnet 
-AddressPrefix 10.0.0.0/24

 New-AzureRMVirtualNetwork -Name SP2016Vnet -ResourceGroupName $rgName 
-Location $locName -AddressPrefix 10.0.0.0/16 -Subnet $spSubnet 
-DNSServer 10.0.0.4

Unfortunately I got the error message

WARNING: The output object type of this cmdlet will be modified in a future release.
New-AzureRMVirtualNetwork : Subscription <Guid> is not registered with NRP.
StatusCode: 409
ReasonPhrase: Conflict
OperationID : '0937045e-3d71-411f-ba11-785e5fcff586'
At line:1 char:1
+ New-AzureRMVirtualNetwork -Name SP2016Vnet -ResourceGroupName $rgName -Location ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 + CategoryInfo : CloseError: (:) [New-AzureRmVirtualNetwork], NetworkCloudException
 + FullyQualifiedErrorId : Microsoft.Azure.Commands.Network.NewAzureVirtualNetworkCommand

errorwithnew_azurermvirtualnetwork_notregisteredwithnrp

After spending a while googling through solutions , I gave up and tried to modify the script until I get it working.

The fix was to enclosed the parameter “Name” value between double quotes when calling method New-AzureRMVirtualNetworkSubnetConfig.

$spSubnet=New-AzureRMVirtualNetworkSubnetConfig 
-Name "SP2016Subnet" -AddressPrefix 10.0.0.0/24

New-AzureRMVirtualNetwork -Name SP2016Vnet 
-ResourceGroupName $rgName -Location $locName 
-AddressPrefix 10.0.0.0/16 -Subnet $spSubnet -DNSServer 10.0.0.4

The cmdlets work after the fix.

new_azurermvirtualnetwork_withouterrors

 

CRM Dynamics 2015 “Error Uploading Report” caused by using Visual Studio 2015

When I was trying to upload a SSRS report to replace an existing report to CRM Dynamics 2015 solution, I got the error

Error Uploading Report

An error occurred while trying to add the report to Microsoft Dynamics CRM.

erroruploadingreport

The error message does not say much.

I decided to use Visual Studio 2015 to edit the CRM report which has caused the issue.

I compared the code behind of the previous report and new report and found that there are new XML elements in the report generated by visual studio 2015 (SQL Server Data Tools for Visual Studio 2015). For example, “reportsections” xml tag has been inserted.

 <ReportSections>
 <ReportSection>
 <Body>
 <ReportItems>
 <Tablix Name="Tablix4">
 <TablixBody>
 <TablixColumns>
 <TablixColumn>
 <Width>3in</Width>
 </TablixColumn>
 <TablixColumn>
 <Width>1.5in</Width>
 </TablixColumn>
 <TablixColumn>
 <Width>1.5in</Width>
 </TablixColumn>
 <TablixColumn>
 <Width>1.5in</Width>
 </TablixColumn>
 <TablixColumn>
 <Width>2.0455in</Width>
 </TablixColumn>
 </TablixColumns>
 <TablixRows>
 <TablixRow>

The only option for me was to rework the report in Visual Studio 2013 (SQL Server Data Tools for Visual Studio 2013) before uploading the report to CRM dynamics solution successfully.