Answered by:
Retrieve Created Date of Outlook Appointment in Powershell

Question
-
Hi I can read the start and end date but not the "created" field of an appointment in powershell? Can this be done?
($apApointment.Start.ToString())
But
($apApointment.Created.ToString()) has a null value
Thanks
Thursday, May 19, 2011 3:06 PM
Answers
-
Hello Ben,
Thank you for the info. The property you want is called DateTimeCreated, not Created.
With regards,
Michael | Microsoft Exchange SDKThe Exchange Development Forum Guide has useful information for using the Exchange Development Forum.
Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
- Proposed as answer by Michael MainerMicrosoft employee Thursday, May 19, 2011 3:41 PM
- Marked as answer by Ben Ashdown Thursday, May 19, 2011 3:46 PM
Thursday, May 19, 2011 3:41 PM
All replies
-
Hello Ben,
How did you get apApointment? Please provide the community with more background information so that we can help answer your question.
With regards,
Michael | Microsoft Exchange SDKThe Exchange Development Forum Guide has useful information for using the Exchange Development Forum.
Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Thursday, May 19, 2011 3:10 PM -
Hi Apologies, here is the code, returning all appointments for today with Organizer, Subject, Start and End, but the Created Field returns null?:
$MailboxName = "mymailbox@me.com"
$StartDate = [System.DateTime]::Now
$EndDate = [System.DateTime]::Now.AddDays(1)
$StartDay = [System.DateTime]::Today
$EndDay = [System.DateTime]::now.tostring("dd") + " " +[System.DateTime]::now.tostring("MMMM") + " " + [System.DateTime]::now.tostring("yyyy") + " 23:59:00"$dllpath = "C:\Program Files\Microsoft\Exchange\Web Services\1.0\Microsoft.Exchange.WebServices.dll"
[void][Reflection.Assembly]::LoadFile($dllpath)
$service = New-Object Microsoft.Exchange.WebServices.Data.ExchangeService([Microsoft.Exchange.WebServices.Data.ExchangeVersion]::Exchange2007_SP1)$windowsIdentity = [System.Security.Principal.WindowsIdentity]::GetCurrent()
$sidbind = "LDAP://<SID=" + $windowsIdentity.user.Value.ToString() + ">"
$aceuser = [ADSI]$sidbind$service.AutodiscoverUrl($aceuser.mail.ToString())
$folderid = new-object Microsoft.Exchange.WebServices.Data.FolderId([Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::Calendar,$MailboxName)
$CalendarFolder = [Microsoft.Exchange.WebServices.Data.CalendarFolder]::Bind($service,$folderid)
$cvCalendarview = new-object Microsoft.Exchange.WebServices.Data.CalendarView($StartDate,$EndDay,2000)
$cvCalendarview.PropertySet = new-object Microsoft.Exchange.WebServices.Data.PropertySet([Microsoft.Exchange.WebServices.Data.BasePropertySet]::FirstClassProperties)
$frCalendarResult = $CalendarFolder.FindAppointments($cvCalendarview)foreach ($apApointment in $frCalendarResult.Items){
$psPropset = new-object Microsoft.Exchange.WebServices.Data.PropertySet([Microsoft.Exchange.WebServices.Data.BasePropertySet]::FirstClassProperties)
$apApointment.load($psPropset)
$apApointment.organizer.ToString()
$apApointment.subject.ToString()
$apApointment.Start.ToString()
$apApointment.End.ToString()
$apApointment.Created.ToString()
}I get "You cannot call a method on a null-valued expression." - Although I'm sure Created is a field. Also tried CreatedTime CreatedDate but to no avail
Many Thanks
Thursday, May 19, 2011 3:37 PM -
Hello Ben,
Thank you for the info. The property you want is called DateTimeCreated, not Created.
With regards,
Michael | Microsoft Exchange SDKThe Exchange Development Forum Guide has useful information for using the Exchange Development Forum.
Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
- Proposed as answer by Michael MainerMicrosoft employee Thursday, May 19, 2011 3:41 PM
- Marked as answer by Ben Ashdown Thursday, May 19, 2011 3:46 PM
Thursday, May 19, 2011 3:41 PM