Search the Community
Showing results for tags 'permission'.
-
I have the code for the permission audit nearly working. I am using powershell with ewsutil.dll. The code drags user objects from AD and then looks at their mailbox, recursive search through all folders and outputs to a csv file anything non default, for example inbox read rights etc. However the code is failing on one chunk of code for some mailboxes and not others. $fldarry = new-object EWSUtil.EWS.BaseFolderIdType[] 1 $dTypeFld = new-object EWSUtil.EWS.DistinguishedFolderIdType $dTypeFld.Id = [EWSUtil.EWS.DistinguishedFolderIdNameType]::msgfolderroot $mbMailbox = new-object EWSUtil.EWS.EmailAddressType $mbMailbox.EmailAddress = $mbMailboxEmail $dTypeFld.Mailbox = $mbMailbox $fldarry[0] = $dTypeFld $FolderList = $ewc.GetAllMailboxFolders($fldarry) $fldarry1 = new-object EWSUtil.EWS.BaseFolderIdType[] $FolderList.Count for ($fcint=0;$fcint -lt $FolderList.Count;$fcint++){ $fldarry1[$fcint] = $FolderList[$fcint].FolderId } $Folders = $ewc.GetFolder($fldarry1) If ($Folders.Count -ne 0) { ForEach ($Folder in $Folders) { Above is the section of code that fails, on the line where $fldarry1 is created below the for, I get on some mailboxes the following error. Exception calling "GetFolder" with "1" argument(s): "The request failed schema validation: The element 'FolderIds' in namespace 'http://schemas.microsoft.com/ exchange/services/2006/messages' has incomplete content. List of possible eleme nts expected: 'FolderId, DistinguishedFolderId' in namespace 'http://schemas.mi crosoft.com/exchange/services/2006/types'." At #############:175 char:26 + $Folders = $ewc.GetFolder <<<< ($fldarry1) + CategoryInfo : NotSpecified: ( [], MethodInvocationException + FullyQualifiedErrorId : DotNetMethodException Any help would be appreciated. Thanks.