0

how can I view contacs in self created "Contact Subfolders" with "PHP-EWS"?

With this Code:

$request = new FindItemType();
$request->ItemShape = new ItemResponseShapeType();
$request->ItemShape->BaseShape = DefaultShapeNamesType::ALL_PROPERTIES; 

$request->ContactsView = new ContactsViewType();
$request->ContactsView->InitialName = 'a';
$request->ContactsView->FinalName = 'z';

$request->ParentFolderIds->DistinguishedFolderId = new DistinguishedFolderIdType();
$request->ParentFolderIds->DistinguishedFolderId->Id = DistinguishedFolderIdNameType::CONTACTS;

$request->Traversal = ItemQueryTraversalType::SHALLOW;  

$response = $client->FindItem($request);

I can only view contacts in the "Contacts Root Folder" but no created Users in self created "Contact Subfolders".

How can i fix this? Please with a small example.

Thanks

Daniel T
  • 1
  • 1

1 Answers1

0

DistinguishedFolderIdType means WellKnown in EWS. As your Folder is created by you...

$request                           = new FindItemType();
$request->ItemShape                = new ItemResponseShapeType();
$request->ItemShape->BaseShape     = DefaultShapeNamesType::ALL_PROPERTIES;     
$request->ParentFolderIds          = new NonEmptyArrayOfBaseFolderIdsType();
$request->ContactsView             = new ContactsViewType();
$request->ParentFolderIds->FolderId = new FolderIdType();
$request->ParentFolderIds->FolderId->Id = $psFolderGuid;
$request->Traversal                = ItemQueryTraversalType::SHALLOW;   

so first get the $psFolderGuid /id

FatFreddy
  • 1,160
  • 1
  • 9
  • 16