Fix folder type restriction#156
Conversation
When parsing SyncFolderHierarchy response the child element had to be "Folder". Which is not the case for non mail folders like calendar folders or contact folders. Now it accepts any kind of child element, expecting it to have a folder_id inside.
|
@SebastianBecker2 You mean a CalendarFolder? This seems to be allowed here: https://docs.microsoft.com/en-us/exchange/client-developer/web-service-reference/create-foldersync As well as ContactsFolder, SearchFolder and TasksFolder. Would be better to check for all of these five different types instead of accepting every element. |
|
That would definitely be possible. Do you have a good idea on how to do it? |
|
As a side note: The reason I was so surprised that the users inbox had a CalendarFolder was that it isn't possible to do this in Outlook. Or at least I couldn't find a way to do this. |
|
What about something like this? (Just an outline. Haven't tested it yet): //! Utility function for finding the first node of
//! a list of names.
//! \param elem XML node the node should retrieved from
//! \param node_names Names of requested nodes
//! \returns Pointer to found XML node
inline rapidxml::xml_node<>* find_first_node_of_ns(
const rapidxml::xml_node<>& elem,
const Ch* namespace,
const std::vector<std::string>& node_names)
{
using namespace rapidxml;
xml_node<>* result;
for (auto name : node_names)
{
result = elem.first_node_ns(namespace, name);
if (result)
{
return result;
}
}
return result;
}Then it is possible to retrieve several node types: std::vector<std::string> elem_list = { "Folder",
"ContactsFolder", "SearchFolder", "TaskFolder" };
const auto folder_elem = item_elem.find_first_node_of_ns(
internal::uri<>::microsoft::types(), elem_list);
check(folder_elem,
"Expected <Folder>, <ContactsFolder>, <SearchFolder> or <TaskFolder> element"); |
|
Tests were fine. Checking will be improved in #161 |
When parsing SyncFolderHierarchy response the child element had to be
"Folder". Which is not the case for non mail folders like calendar
folders or contact folders. Now it accepts any kind of child element,
expecting it to have a folder_id inside.
One of our customers had a calendar folder in his inbox. Not sure how.
Neither Outlook nor OWA allows the creation of a non-mail folder in
inbox.
Though I did manage to reproduce it using Microsofts EwsEditor.