Git Product home page Git Product logo

crmpowershell's People

Contributors

amsoftwarenl avatar richieroxx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

crmpowershell's Issues

Provide clear error info when connection fails

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.

Steps to reproduce

Connect-CrmOrganization -ConnectionString '[incorrect connectionstring]'
Connect-CrmOrganization -Connection [Connection in incorrect state]

Expected behavior

Clear error the connection is not setup correctly and why

Actual behavior

Connect-CrmOrganization : Method not found: 'Microsoft.Xrm.Sdk.Discovery.OrganizationDetail Microsoft.Xrm.Tooling.Connector.CrmServiceClient.get_OrganizationDetail()'.

Environment data

Online
v2.0.0.0

Set new attributes to in-memory entity not possible

Steps to reproduce

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')

Expected behavior

Attribute and value are added to the Attributes-collection.

Actual behavior

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 

Environment data

Dynamics 365 CRM v8.2.2.2464;
AMSoftware.Crm Module v1.4.0.0

Deployment mandatory with Register-CrmPluginStep

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"

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"

Steps to reproduce

Connect-CrmOrganization $OrgUniqueName

Expected behavior

successfull connection to org

Actual behavior

Error: "metadata contains a reference that cannot be resolved"
Environment data

Dynamics 365 crm Online (Office 365) on Version 9.0.0.3172

v1.3.0.0

Labels do not support ToString()

Steps to reproduce

Get-CrmEntity |? { $_.DisplayName.ToString() -eq 'Organisatie' }

Expected behavior

Expected list of entities where DisplayName (in current language) is 'Organisatie'.

Actual behavior

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

  • Get-CrmEntity |? { $_.DisplayName.ToString() -eq 'Organisatie' }
  •                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    • FullyQualifiedErrorId : ScriptMethodRuntimeException

Environment data

Version: v1.3.0.0
Connected to Dynamics 365 CRM Online

Connect-CrmOrganization throws error

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

Environment data

v2.0.0.0

Manage Roles and Privileges

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

  • Manage (List, Create, Update, Delete) Roles and Privileges
  • Check privileges and roles for users or teams
  • Check privileges per entity (included in which Security Role, etc.)

FetchXML with aggregate executes as query without aggregate

An FetchXML with an aggregation returns the records of the entity without aggregation.

Steps to reproduce

<fetch aggregate="true">
  <entity name="contact">
    <attribute name="fullname" alias="count_fullname" aggregate="count" />
  </entity>
</fetch>

Get-CrmContent -Fetch $xml

Expected behavior

Single record with 'count_fullname' attribute containing count

Actual behavior

list of contact without aggregation.

Environment data

v1.4.0.1

Set-CrmBooleanAttribute doesn't update True or False value

Steps to reproduce

Set-CrmBooleanAttribute -Entity ... -Attribute ... -TrueValue ... -FalseValue ...

Expected behavior

Metadata for True and False values are updated.

Actual behavior

True and False value metadata doesn't get updated. No exception, just nothing.

Environment data

v1.3.0.0

IntelliSense on Entities, Attributes and other Metadata

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.

Get and Set Environment Variables

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:

  • List including default value and environment value
  • Create/Set, including setting the default values as well as the environment value.
  • Clear environment value
    Could be additional option in export solution as the environment values should be empty on export.
  • Remove environment variable

FetchXml with aggregate fails on PagingCookie

Steps to reproduce

Execute the following script:
$contacts = Get-CrmContent -FetchXml '<fetch aggregate="true"><entity name="contact"/></fetch>'
Expected behavior

$contacts contains all requested contacts.

Actual behavior

The following exception is thrown:
Get-CrmContent : The Top.Count = 5000 can't be specified with pagingInfo
At line:3 char:13

  • $contacts = Get-CrmContent -FetchXml $fetchxml
  •         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : CloseError: (:) [Get-CrmContent], FaultException`1
    • FullyQualifiedErrorId : AMSoftware.Crm.PowerShell.Commands.Content.GetContentCommand

Environment data

version: 1.4.0.1

Add Invoke-CrmWebApiRequest

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.

Add features for (Access) Teams

Some improvements are added to Teams which aren't supported in de powershell library:

  • (Access) Teams based in Azure AD Security Groups or Office Groups
  • Support for Team Templates

Cmdlet "Set-content" is in conflict with PowerShell built-in cmdlet "set-content"

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?!


Actual behavior

Environment data

v1.3.1.2

Strange behaviour after update to 2.1.0.0

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

Environment data

v2.1.0.0

Add-CrmBooleanAttribute throw NullReferenceException

Steps to reproduce

Add-CrmBooleanAttribute -Entity 'pst_powershell1' -Name 'pst_boolean' -DisplayName 'Boolean' -DefaultValue $true -TrueValue $truevalue -FalseValue $falsevalue -Required Required -SchemaName 'pst_boolean' -PassThru

Expected behavior

Boolean attribute is created.

Actual behavior

throws NullReferenceException. Attribute is not created.

Environment data

v1.3.0.0

Labels cannot be converted to string

Steps to reproduce

Get-CrmEntity |? { $($_.DisplayName) -eq 'Organisatie' }
No result and no errors

Get-CrmEntity |? { $($_.DisplayName) -like 'Organisatie' }
Errors

Expected behavior

Result of entities with DisplayName (in current language) 'Organisatie'.

Actual behavior

No result for -eq operator.

Errors for -like operator
Cannot convert value to type System.String.
At line:1 char:22

  • Get-CrmEntity |? { $($_.DisplayName) -like 'Organisatie' }
  •                  ~~~~~~~~~~~~~~
    
    • CategoryInfo : InvalidArgument: (:) [], RuntimeException
    • FullyQualifiedErrorId : InvalidCastFromAnyTypeToString

Environment data

Version: 1.3.0.0
Connected to Dynamics 365 CRM Online

Mandatory OAuth2.0

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

Steps to reproduce

Connect-CrmDeployment -Credential $credential -Region $CRMRegion -Verbose

Expected behavior

Connection to CrmDEployment ;)

Actual behavior

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

Environment data

Connect-CrmOrganization to not existing organization shows illogical errortext.

Steps to reproduce

Connect-CrmOrganization crm
Where 'crm' is not existing organization.

Expected behavior

Error in the form 'organization not found'

Actual behavior

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

Environment data

v1.3.0.0

Add-CrmOptionSetAttribute throws exception 'IsGlobal not specified'

Steps to reproduce

Add-CrmOptionSetAttribute -Entity 'pst_test1' -Name 'pst_picklistlocal' -DisplayName 'Picklist Local' -DefaultValue 1 -Values $picklistvalues -Required Recommended -SchemaName 'pst_picklistlocal' -PassThru

Expected behavior

Attribute is created.

Actual behavior

Exception is thrown. 'IsGlobal not specified'. Attribute is not created.

Environment data

v1.3.0.0

Issue with Add-CrmSolutionComponent

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 throws NullReferenceException

Steps to reproduce

Add-CrmOptionSetAttribute -Entity 'pst_test1' -Name 'pst_picklistglobal' -DisplayName 'Picklist Global' -OptionSet 'pst_picklistglobal' -Required Recommended -SchemaName 'pst_picklistglobal' -PassThru

Expected behavior

Picklist attribute is created

Actual behavior

Throws NullReferenceException. Attribute isn't created

Environment data

v1.3.0.0

Use Xrm.Tooling.CrmConnector from the SDK or the Powershell cmdlet to connect to Dynamics/Dataverse

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.

Set-CrmPrincipalRoles, Set-CrmRolePrincipals, Set-CrmTeamUsers or Set-CrmUserTeams can't be used to clear all related or remove several.

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]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.