如何使用“PHP-EWS”查看自己创建的“联系子文件夹”中的联系人?
使用此代码:
$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);
我只能在“联系人根文件夹”中查看联系人,但在自己创建的“联系子文件夹”中没有创建用户。
我该如何解决这个问题?请举个小例子。
由于
答案 0 :(得分:0)
DistinguishedFolderIdType表示EWS中的WellKnown。由于您的文件夹是由您创建的...
$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;
所以先获取$ psFolderGuid / id