amsoftwarenl / crmpowershell Goto Github PK
View Code? Open in Web Editor NEWManage Power Platform Dataverse metadata and content, and administer the environment. Use on-premises and online.
License: GNU Affero General Public License v3.0
Manage Power Platform Dataverse metadata and content, and administer the environment. Use on-premises and online.
License: GNU Affero General Public License v3.0
Improvement based on #32
When failing to connect to environment, this is not handled correctly in Connect-CrmOrganization. It tries to get the OrganizationDetails instead of throwing an exception for not connecting.
Connect-CrmOrganization -ConnectionString '[incorrect connectionstring]'
Connect-CrmOrganization -Connection [Connection in incorrect state]
Clear error the connection is not setup correctly and why
Connect-CrmOrganization : Method not found: 'Microsoft.Xrm.Sdk.Discovery.OrganizationDetail Microsoft.Xrm.Tooling.Connector.CrmServiceClient.get_OrganizationDetail()'.
Online
v2.0.0.0
To invoke the FullfilSalesOrderRequest, an OrderClose entity must be added as parameter. This is an in-memory representation.
$e = New-Object -TypeName 'Microsoft.Xrm.Sdk.Entity' -ArgumentList 'orderclose'
$e.subject = 'test'
$e.Attributes.Add('subject', 'test')
Attribute and value are added to the Attributes-collection.
Exception is thrown:
Exception setting "subject": "The property 'subject' cannot be found on this object. Verify that the property exists and can be set."
At line:1 char:1
+ $e.subject = 'test'
+ ~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], SetValueInvocationException
+ FullyQualifiedErrorId : ExceptionWhenSetting
Dynamics 365 CRM v8.2.2.2464;
AMSoftware.Crm Module v1.4.0.0
With Register-CrmPluginStep it is mandatory to provide an option for Deployment (Server, Offline, Both).
Should provide a default value (probably Both) and not be mandatory.
Version: v2.1.1.0
When connecting to a Dynamics 365 crm Online (Office 365) on Version 9.0.0.3172 I get:
"metadata contains a reference that cannot be resolved"
Connect-CrmOrganization $OrgUniqueName
successfull connection to org
Dynamics 365 crm Online (Office 365) on Version 9.0.0.3172
v1.3.0.0
Get-CrmEntity |? { $_.DisplayName.ToString() -eq 'Organisatie' }
Expected list of entities where DisplayName (in current language) is 'Organisatie'.
Get the following error:
Exception calling "ToString" with "0" argument(s): "Method invocation failed because [AMSoftware.Crm.PowerShell.Common.
Converters.LabelConverter] does not contain a method named 'ConvertToString'."
At line:1 char:20
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Version: v1.3.0.0
Connected to Dynamics 365 CRM Online
Set-CrmXxxAttribute ...
Attribute is correctly updated
Merge of original attribute and modification is unpredictable
v1.3.0.0
Update entity attribute (Boolean or picklist) metadata values. Throws exception.
v1.3.0.0
Create and edit multi-table lookup columns as available in 2021 Wave 1 Release.
https://docs.microsoft.com/en-us/powerapps/developer/data-platform/webapi/multitable-lookup
Dataverse allows for impersonation of the requests.
https://docs.microsoft.com/en-us/powerapps/developer/data-platform/impersonate-another-user
Add the option to impersonate another user. Both for the OrganizationService (CallerId) as for direct WebAPI calls (using Invoke-CrmWebApiRequest). In The last case the CallerObjectId header must be added.
Steps to reproduce
Using Connect-CrmOrganzation with parameter -Connectionstring throws error
Connect-CrmOrganization : Method not found: 'Microsoft.Xrm.Sdk.Discovery.OrganizationDetail Microsoft.Xrm.Tooling.Connector.CrmServiceClient.get_OrganizationDetail()'.
I tried it also with parameter -Connection but the same behaviour.
I checked also the dependency Microsoft.Xrm.Tooling.CrmConnector.PowerShell and using it in version 3.3.0.928.
I´m not sure if there is another dependency which I can check before.
Expected behavior
Connect-CrmOrganization call is successful
Actual behavior
Connect-CrmOrganization call throws error
v2.0.0.0
The PowerShell Library does support retrieving roles and assign Roles to Users or Teams (or Teams or User to Roles).
There are no cmdlets to
Set-CrmOptionSetAttribute ....
Updates the Picklist or Boolean attribute
Parameters and results are unpredictable.
v1.3.0.0
An FetchXML with an aggregation returns the records of the entity without aggregation.
<fetch aggregate="true">
<entity name="contact">
<attribute name="fullname" alias="count_fullname" aggregate="count" />
</entity>
</fetch>
Get-CrmContent -Fetch $xml
Single record with 'count_fullname' attribute containing count
list of contact without aggregation.
v1.4.0.1
Set-CrmBooleanAttribute -Entity ... -Attribute ... -TrueValue ... -FalseValue ...
Metadata for True and False values are updated.
True and False value metadata doesn't get updated. No exception, just nothing.
v1.3.0.0
Metadata information is available in Dynamics. It would make commands easier if auto-completion on metadata items is available. Especially because names (of entities, attributes, etc) are case-sensitive.
For example: Get-CrmContent -Entity account
'account' could be autocompleted based on known metadata.
Power Platform introduced Environment Variables in Solutions.
https://docs.microsoft.com/en-us/powerapps/maker/data-platform/EnvironmentVariables
Environment Variables have a default value in the solution, and a set value for environments.
Support Environment Variables with the following:
$contacts = Get-CrmContent -FetchXml '<fetch aggregate="true"><entity name="contact"/></fetch>'
$contacts contains all requested contacts.
The following exception is thrown:
Get-CrmContent : The Top.Count = 5000 can't be specified with pagingInfo
At line:3 char:13
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
version: 1.4.0.1
The WebAPI endpoint provides functionality through REST/OData not available through the SDK.
In addition it is a great way to test REST/OData commands to use in script or .NET applications
Command to invoke the request should support querystring and body.
Return body as string as it can be converted from JSON using powershell (Convert-FromJson). No use spending effort on this.
Some improvements are added to Teams which aren't supported in de powershell library:
Power Platform introduced Connection References in Solutions.
https://docs.microsoft.com/en-us/powerapps/maker/data-platform/create-connection-reference
Support Connection References with the following:
Optional create and set if possible.
Steps to reproduce
When crmpowershell-module is installed other scripts that use "set-content" expect to use the built-in cmdlet of PowerShell while they actually use the "set-content" of crmpowershell which has a different functionality. Example is:
Visual Studio Code Powershell Language Services has a Start-EditorServices.ps1 which uses "set-content" and fails at start: PowerShell/vscode-powershell#1331
Expected behavior
since there is a "set-crmcontent"-cmdlet which does the same, "set-content" could be removed?!
v1.3.1.2
Steps to reproduce
After updating to new version some calls returned strange results. This behaviour stops after reverting the update and using 2.0.0.0 again.
Expected behavior
For example the call of Get-CrmBusinessUnit with parameter -Name returned the ID of a team with complete other name instead of the given BusinessUnit. Also Set-CrmUserTeams sets the team to another team instead of the one giving with the parameter -Teams
Actual behavior
After reverting the update everything is running well
v2.1.0.0
Add-CrmBooleanAttribute -Entity 'pst_powershell1' -Name 'pst_boolean' -DisplayName 'Boolean' -DefaultValue $true -TrueValue $truevalue -FalseValue $falsevalue -Required Required -SchemaName 'pst_boolean' -PassThru
Boolean attribute is created.
throws NullReferenceException. Attribute is not created.
v1.3.0.0
Get-CrmEntity |? { $($_.DisplayName) -eq 'Organisatie' }
No result and no errors
Get-CrmEntity |? { $($_.DisplayName) -like 'Organisatie' }
Errors
Result of entities with DisplayName (in current language) 'Organisatie'.
No result for -eq operator.
Errors for -like operator
Cannot convert value to type System.String.
At line:1 char:22
~~~~~~~~~~~~~~
Version: 1.3.0.0
Connected to Dynamics 365 CRM Online
Hey,
have you ever ecountered Environments with mandatory OAuth2.0-Authentication? I just did... :-/
https://docs.microsoft.com/en-us/powerapps/developer/data-platform/authenticate-dot-net-framework
Connect-CrmDeployment -Credential $credential -Region $CRMRegion -Verbose
Connection to CrmDEployment ;)
Connect-CrmOrganization : An error occurred when processing the security tokens in the message:You are using Ws-Tust authentication which has been deprecated and no longer
supported in your environment. Please use oAuth2.0 authentication.
In C:\myscript.ps1:22 Zeichen:1
+ Connect-CrmOrganization $OrgUniqueName
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : CloseError: (:) [Connect-CrmOrganization], FaultException
+ FullyQualifiedErrorId : AMSoftware.Crm.PowerShell.Commands.Discovery.ConnectOrganizationCommand
Connect-CrmOrganization crm
Where 'crm' is not existing organization.
Error in the form 'organization not found'
Connect-CrmOrganization : Operation is not valid due to the current state of the object.
At line:1 char:1
+ Connect-CrmOrganization crm
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (AMSoftware.Crm....nizationCommand:ConnectOrganizationCommand) [Connect-Crm
Organization], InvalidOperationException
+ FullyQualifiedErrorId : AMSoftware.Crm.PowerShell.Commands.Discovery.ConnectOrganizationCommand
v1.3.0.0
Option to create/manage a virtual entity.
As this provides the option to select a custom datasource, we also need to possibility to register a custom datasource.
NOTE: Datasources have an additional attribute on fields to secure the value.
See https://docs.microsoft.com/en-us/dynamics365/customerengagement/on-premises/customize/create-edit-virtual-entities for details.
Service Endpoints include EventHub and WebHooks which are not available in Register-CrmServiceEndpoint
Created new attribute without providing an explicit SchemaName.
Attribute is created with SchemaName being equal to Name.
Throws exception claiming SchemaName must be provided but isn't.
v1.3.0.0
Add-CrmOptionSetAttribute -Entity 'pst_test1' -Name 'pst_picklistlocal' -DisplayName 'Picklist Local' -DefaultValue 1 -Values $picklistvalues -Required Recommended -SchemaName 'pst_picklistlocal' -PassThru
Attribute is created.
Exception is thrown. 'IsGlobal not specified'. Attribute is not created.
v1.3.0.0
Hi,
I'm getting this kind of error "Input field type 'Boolean' does not match expected type 'String[]' for field 'IncludedComponentSettingsValues'" when trying to add a component to the solution. The way I do this is I use Get-CrmWebresource and Get-CrmSolution cmdlets to get the GUIDs of the solution and web resource. After that, I use these GUIDs to add the component to the solution.
Thanks,
Regards Arsen.
Add-CrmOptionSetAttribute -Entity 'pst_test1' -Name 'pst_picklistglobal' -DisplayName 'Picklist Global' -OptionSet 'pst_picklistglobal' -Required Recommended -SchemaName 'pst_picklistglobal' -PassThru
Picklist attribute is created
Throws NullReferenceException. Attribute isn't created
v1.3.0.0
Current authentication is limited because of the manual implementation. Works great for simple scenario's but has limitations when connection to online (MFA, OAuth, etc.) or on-premises (ADFS, WAP, etc).
Using the Xrm.Tooling will support all possible login methods and Microsoft will keep this up-to-date.
https://docs.microsoft.com/en-us/powerapps/developer/data-platform/xrm-tooling/build-windows-client-applications-xrm-tools
https://docs.microsoft.com/en-us/dynamics365/customerengagement/on-premises/developer/build-windows-client-applications-xrm-tools
This adds another dependency, but adds alot.
It isn't possible to clear all Roles, Teams or Users from a Role, Team or User.
Using -Overwrite clears all and assigns new, but an empty array can't be provided to just clear all.
Also extra effort is needed to just remove a single or few Roles, Teams, or Users.
Using:
Set-CrmPrincipalRoles [-Principal] <guid> [-PrincipalType] {User | Team} -Roles <guid[]> [-Overwrite] [-PassThru]
Set-CrmRolePrincipals [-Role] <guid> [-PrincipalType] {User | Team} -Principals <guid[]> [-Overwrite] [-PassThru]
Set-CrmTeamUsers [-Team] <guid> [-Users] <guid[]> [-Overwrite] [-PassThru]
Set-CrmUserTeams [-User] <guid> [-Teams] <guid[]> [-Overwrite] [-PassThru]
Dataverse supports batch operations. This is not part of the SDK/OrganizationService but works with the WebAPI.
https://docs.microsoft.com/en-us/powerapps/developer/data-platform/webapi/execute-batch-operations-using-web-api
Would require something like:
Special focus on ChangeSets in Batch and adding requests, and the response as it is a multipart/mixed.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.