Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Dynamics 365 general forum

Create activity and activityparty in Powershell

(0) ShareShare
ReportReport
Posted on by 249

I can create an appointment using Microsoft.Xrm.Sdk powershell although I'm not sure how to add attendees. It is not possible to create activityparty records via powershell. The requiredattendees field is available on the appointment entity, it has a type of Microsoft.Xrm.Sdk.EntityCollection. I need to create an EntityCollection containing contacts and/or users and then associate that collection with the activity. 

Is anyone aware of how to create the EntityCollection?

Categories:
  • Suggested answer
    pawin Profile Picture
    pawin 249 on at
    RE: Create activity and activityparty in Powershell

    $activityParties = New-Object Microsoft.Xrm.Sdk.EntityCollection

    [Microsoft.Xrm.Sdk.EntityReference]$partyEntityRef = New-CrmEntityReference -EntityLogicalName contact -Id $contactId        

    [Microsoft.Xrm.Sdk.Entity]$activityPartyEntity = New-Object Microsoft.Xrm.Sdk.Entity

    $activityPartyEntity.LogicalName = 'activityparty'            

    $activityPartyEntity.Attributes['partyid'] = $partyEntityRef                    

    $activityParties.Entities.Add($activityPartyEntity)      

  • RaviKashyap Profile Picture
    RaviKashyap 55,410 Moderator on at
    RE: Create activity and activityparty in Powershell

    Can you share the fix here so that it can help others :)

  • Suggested answer
    pawin Profile Picture
    pawin 249 on at
    RE: Create activity and activityparty in Powershell

    Resolved this myself.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,432 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans