Last active
February 19, 2021 05:54
-
-
Save gscales/84e2d5fc0bb9cdccf634be84510c2f64 to your computer and use it in GitHub Desktop.
Get the TeamsMessagesDataFolder
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $folderid= new-object Microsoft.Exchange.WebServices.Data.FolderId([Microsoft.Exchange.WebServices.Data.WellKnownFolderName]::Inbox,$MailboxName) | |
| $TeamsMessagesDataFolderEntryId = new-object Microsoft.Exchange.WebServices.Data.ExtendedPropertyDefinition([System.Guid]::Parse("{E49D64DA-9F3B-41AC-9684-C6E01F30CDFA}"), "TeamsMessagesDataFolderEntryId", [Microsoft.Exchange.WebServices.Data.MapiPropertyType]::Binary); | |
| $psPropset= new-object Microsoft.Exchange.WebServices.Data.PropertySet([Microsoft.Exchange.WebServices.Data.BasePropertySet]::FirstClassProperties) | |
| $psPropset.Add($TeamsMessagesDataFolderEntryId) | |
| $RootFolder = [Microsoft.Exchange.WebServices.Data.Folder]::Bind($service,$folderid,$psPropset) | |
| if ($RootFolder.TryGetProperty($TeamsMessagesDataFolderEntryId,[ref]$FolderIdVal)) | |
| { | |
| $TeamsMessagesFolderId= new-object Microsoft.Exchange.WebServices.Data.FolderId((ConvertId -HexId ([System.BitConverter]::ToString($FolderIdVal).Replace("-","")) -service $service)) | |
| $TeamsMessagesDataFolder = [Microsoft.Exchange.WebServices.Data.Folder]::Bind($service,$TeamsMessagesFolderId); | |
| } | |
| function ConvertId{ | |
| param ( | |
| [Parameter(Position=1, Mandatory=$false)] [String]$HexId, | |
| [Parameter(Position=2, Mandatory=$false)] [Microsoft.Exchange.WebServices.Data.ExchangeService]$service | |
| ) | |
| process{ | |
| $aiItem = New-Object Microsoft.Exchange.WebServices.Data.AlternateId | |
| $aiItem.Mailbox = $MailboxName | |
| $aiItem.UniqueId = $HexId | |
| $aiItem.Format = [Microsoft.Exchange.WebServices.Data.IdFormat]::HexEntryId | |
| $convertedId = $service.ConvertId($aiItem, [Microsoft.Exchange.WebServices.Data.IdFormat]::EwsId) | |
| return $convertedId.UniqueId | |
| } | |
| } |
Did you try to add Full Permissions via add-mailboxpermission ? the other thing would be try to retrieve it via code instead it could just be a bug in that app
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you, it helped me a bit, but still not helping to get the actual functionality. With the above I am able to see the content of the folder "Top of Information Store". that doesn't have any TeamMessagesdata folder.
Unable to connect to the root folder.
The below error is coming, the logged on user has the delegate access to the group mailbox and also has compliance administrator and global administrator assigned.
suggest me if anything is missing w.r.t roles or permission.
BTW , the below is the error, when I am trying to expand the root tress structure
