Closed l0ckm4 closed 3 years ago
When you call getFolder
in this library, you can pass along additional options which are just merged into the request. So you could try something like this:
$api->getFolder($id, [
'AdditionalProperties' => [
'ExtendedFieldURI' => ['PropertyTag' => '0x0e08', PropertyType => 'Integer']
]
]);
I'm not sure if that's entirely the right structure, but the idea is that the options keyed array gets transformed into the XML that you need to make the call, so by playing around with what you pass in there you can make the XML request look however you want to
Thanks Gareth
That put me in the right direction. I had to make a slight amendment to your suggestion. The actual code to get the folder with the folder size is :-
$options = array(
'FolderShape' => array (
'AdditionalProperties' => [
'ExtendedFieldURI' => ['PropertyTag' => '0x0e08', 'PropertyType' => 'Integer']
]
)
);
$api = MailAPI::withUsernameAndPassword($host,$username,$password,["version" => 'Exchange2010_SP1', 'impersonation' => 'someone@somewhere.com']);
$folder = $api->getFolderByDistinguishedId(\garethp\ews\API\Type\DistinguishedFolderIdNameType::INBOX, $options);
$inbox = array(
'total emails' => $folder->getTotalCount(),
'unread emails' => $folder->getUnreadCount(),
'size of folder' => $folder->getExtendedProperty()->getValue()
);
print_r($inbox);
give me
Array
(
[total emails] => 7440
[unread emails] => 1
[size of folder] => 1442608601
)
Which matches exactly with what I see in Outlook.
Cheers Mark
Is there any method available to be able to obtain the size of a mailbox and/or the size of a folder in a mailbox?
On the technet forum someone has said it is possible using extended properties but i have no idea how to do this using this library.
Thanks in advance