Archive

Author Archive

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

November 24, 2016 Leave a comment

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.

http://bit.ly/2fvBe9X

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

 

 

from reshmeeauckloo http://bit.ly/2fvBhT2

Reshmee Auckloo
Reshmee Auckloo – Reshmee is a certified Microsoft professional and has been involved in delivering solutions across a wide variety of industry sectors in a range of assignments from SSRS to Microsoft SharePoint, Project Server development, CRM Dynamics and .Net including business requirements gathering and software quality assurance.

This article has been cross posted from reshmeeauckloo.wordpress.com (original article)

#ProjectOnline new #OData resource path for Resource Demand #Reporting #BI #O365 #PPM

November 22, 2016 Leave a comment
Paul Mather
I am a Project Server and SharePoint consultant but my main focus currently is around Project Server.
I have been working with Project Server for nearly five years since 2007 for a Microsoft Gold Certified Partner in the UK, I have also been awared with the Microsoft Community Contributor Award 2011.
I am also a certified Prince2 Practitioner.

This article has been cross posted from pwmather.wordpress.com (original article)

This post covers a new resource path in the OData endpoint for Microsoft’s PPM tool Project Online to give you the data you need for true resource demand for project assignments and resource engagement assignments. Before resource engagements were introduced, you could have assignments in the project plans or in the resource plans. For reporting, the data was available in the Assignments and the AssignmentTimephasedDataSet resource path feeds, normal project assignments data would be in the AssignmentWork field and resource plan work was in the AssignmentResourcePlanWork field. There was also an AssignmentCombinedWork in the AssignmentTimephasedDataSet feed that displayed the correct resource demand for the resource when you used both resource plans and project plans. The AssignmentCombinedWork field would take into account for the project resource utilisation calculation options. With the introduction of resource engagements there wasn’t a single field that gave you this same resource demand data – until now!

If you regularly view the Project OData service root URL (_api/ProjectData) you might have noticed a new feed, ResourceDemandTimephasedDataSet. This feed has the following properties:

image

The ResourcePlanUtilizationType type will display either a 0, 1 or 2. This is the property to indicate the project resource utilisation calculation options for the project. The enumeration for these values is below:

  • o = Project Plan
  • 1 = Resource Engagements
  • 2 = Project Plan Until

The ResourcePlanUtilizationDate property will only contain a date when the “Project Plan Until” resource utilisation calculation option is set.

This new ResourceDemandTimephasedDataSet feed will show the true resource demand for the project resource utilisation calculation option when using both project assignments and resource engagements. Some scenarios below show when data would and wouldn’t be included in this new feed:

Scenario 1: Project plan has resource assignments and resource engagements. The “Calculate Resource Utilization from:” option is set to Project Plan. In this scenario only the project assignments will be included in the ResourceDemandTimephasedDataSet feed.

Scenario 2: Project plan has resource assignments and resource engagements. The “Calculate Resource Utilization from:” option is set to Resource Engagements. In this scenario only the resource engagement assignments will be included in the ResourceDemandTimephasedDataSet feed.

Scenario 3: Project plan has resource assignments and resource engagements. The project assignments start from the 20th November to the 10th December 2016. The Resource engagements start from the 25th November to the 20th December 2016. The “Calculate Resource Utilization from:” option is set to Project Plan until with a date set to 1st December 2016. In this scenario only the project assignments will be included from the 20th November 2016 up to and including the 1st December 2016 and only resource engagement assignments from the 2nd December to 20th December 2016  will be included in the ResourceDemandTimephasedDataSet feed.

Example data can be seen below:

image

That makes things far easier for reporting resource demand, without this new feed you had to use the AssignmentTimephasedDataSet feed and the EngagementsTimephasedDataSet feed and join the datasets.

Categories: Paul Mather, Work Tags:

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

November 18, 2016 Leave a comment

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

from reshmeeauckloo http://bit.ly/2g2Rv3M

Reshmee Auckloo
Reshmee Auckloo – Reshmee is a certified Microsoft professional and has been involved in delivering solutions across a wide variety of industry sectors in a range of assignments from SSRS to Microsoft SharePoint, Project Server development, CRM Dynamics and .Net including business requirements gathering and software quality assurance.

This article has been cross posted from reshmeeauckloo.wordpress.com (original article)

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

November 18, 2016 Leave a comment

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

 

from reshmeeauckloo http://bit.ly/2fMkY2r

Reshmee Auckloo
Reshmee Auckloo – Reshmee is a certified Microsoft professional and has been involved in delivering solutions across a wide variety of industry sectors in a range of assignments from SSRS to Microsoft SharePoint, Project Server development, CRM Dynamics and .Net including business requirements gathering and software quality assurance.

This article has been cross posted from reshmeeauckloo.wordpress.com (original article)

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

November 17, 2016 Leave a comment

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.

from reshmeeauckloo http://bit.ly/2g0X1Hv

Reshmee Auckloo
Reshmee Auckloo – Reshmee is a certified Microsoft professional and has been involved in delivering solutions across a wide variety of industry sectors in a range of assignments from SSRS to Microsoft SharePoint, Project Server development, CRM Dynamics and .Net including business requirements gathering and software quality assurance.

This article has been cross posted from reshmeeauckloo.wordpress.com (original article)

Instantiate CRMServiceClient using current user’s login

November 10, 2016 Leave a comment

The Get-CrmConnection method can be used to  return connection to a CRM instance. The syntax to call the method is

Parameter Set: OnLine
Get-CrmConnection [-OnLineType] <OnlineType> [[-Credential] <PSCredential> ] 
[-DeploymentRegion] <String> [[-ProfileName] <String> ] -OrganizationName <String> [ <CommonParameters>]

Parameter Set: OnPrem
Get-CrmConnection [-ServerUrl] <Uri> [[-Credential] <PSCredential> ] 
[-OrganizationName] <String> [[-HomeRealmUrl] <Uri> ] [[-ProfileName] <String> ] 
[ <CommonParameters>]

Parameter Set: UIOnly
Get-CrmConnection [[-InteractiveMode]] [ <CommonParameters>]

I wanted to get the crm connection with the current user’s credentials without any prompts. The first and second options required the object PSCredential which can’t be created using logged current user’s credentials. The third option with the switch InteractiveMode  displays a dialog box prompting to enter connection details. All three options were not appropriate for the requirement.

The method returns the object Microsoft.Xrm.Tooling.CrmServiceClient. From the msdn article, it can be constructed using the NetworkCredential object.

The constructor’s definition in C#

public CrmServiceClient(
	NetworkCredential credential,
	AuthenticationType authType,
	string hostName,
	string port,
	string orgName,
	bool useUniqueInstance = false,
	bool useSsl = false,
	OrganizationDetail orgDetail = null
)

 

In PowerShell, the current user’s credentials can be retrieved using [System.Net.CredentialCache]::DefaultNetworkCredentials.

There is no way the [System.Net.CredentialCache]::DefaultNetworkCredentials can be converted to the PSCredential object.

The below syntax can be used to create the Microsoft.Xrm.Tooling.Connector.CrmServiceClient using logged in user’s credentials. Replace the variables $serverName, $serverPort, $organizationName with the respective values.

 $crmConnection = 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)

from reshmeeauckloo http://bit.ly/2eNVYJF

Reshmee Auckloo
Reshmee Auckloo – Reshmee is a certified Microsoft professional and has been involved in delivering solutions across a wide variety of industry sectors in a range of assignments from SSRS to Microsoft SharePoint, Project Server development, CRM Dynamics and .Net including business requirements gathering and software quality assurance.

This article has been cross posted from reshmeeauckloo.wordpress.com (original article)

#ProjectServer and #SharePoint 2013 / 2016 November 2016 Cumulative Update #PS2013 #SP2013 #PS2016 #SP2016 #MSProject

November 8, 2016 Leave a comment
Paul Mather
I am a Project Server and SharePoint consultant but my main focus currently is around Project Server.
I have been working with Project Server for nearly five years since 2007 for a Microsoft Gold Certified Partner in the UK, I have also been awared with the Microsoft Community Contributor Award 2011.
I am also a certified Prince2 Practitioner.

This article has been cross posted from pwmather.wordpress.com (original article)

The Office 2016 November 2016 updates and cumulative updates are now available, please see the links below:

http://bit.ly/2fCbbev

Project 2016 November 2016 update:
http://bit.ly/2eJY8tK

SharePoint Server 2016 / Project Server 2016 November 2016 update:
http://bit.ly/2fCavG2 & http://bit.ly/2eJZpkt & http://bit.ly/2fCftm0

The Office 2013 November 2016 updates and cumulative updates are now available, please see the links below:

http://bit.ly/2fCbbev

Project Server 2013 November 2016 CU Server Roll up package:
http://bit.ly/2eK2oJI

Project Server 2013 November 2016 update:
http://bit.ly/2fCdoXq

Project 2013 November 2016 update:
http://bit.ly/2eK7FBl

Also worth noting, if you haven’t done so already, install Service Pack 1 http://bit.ly/1uorn2C first if installing the November 2016 CU.

As always, fully test these updates on a replica test environment before deploying to production.

Categories: Paul Mather, Work Tags:
%d bloggers like this: