22 # define _SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING 40 #ifdef EWS_HAS_OPTIONAL 47 #include <type_traits> 50 #ifdef EWS_HAS_VARIANT 53 #include "rapidjson/document.h" 54 #include "rapidxml/rapidxml.hpp" 55 #include "rapidxml/rapidxml_print.hpp" 57 #include <curl/curl.h> 61 #ifdef EWS_ENABLE_VERBOSE 66 #include "ews_fwd.hpp" 70 # ifdef __has_attribute(maybe_unused) 71 # define EWS_MAYBE_UNUSED [[maybe_unused]] 73 # define EWS_MAYBE_UNUSED 76 # define EWS_MAYBE_UNUSED [[maybe_unused]] 79 # define EWS_MAYBE_UNUSED 88 #ifndef EWS_DOXYGEN_SHOULD_SKIP_THIS 90 # ifdef EWS_HAS_DEFAULT_TEMPLATE_ARGS_FOR_FUNCTIONS 91 template <
typename ExceptionType = assertion_error>
93 template <
typename ExceptionType>
95 inline void check(
bool expr,
const char* msg)
99 throw ExceptionType(msg);
103 # ifndef EWS_HAS_DEFAULT_TEMPLATE_ARGS_FOR_FUNCTIONS 105 inline void check(
bool expr,
const char* msg)
107 check<assertion_error>(expr, msg);
111 #endif // EWS_DOXYGEN_SHOULD_SKIP_THIS 117 template <
typename TargetType,
typename SourceType>
118 TargetType numeric_cast(SourceType value)
120 if (static_cast<TargetType>(value) >
121 std::numeric_limits<TargetType>::max())
123 throw std::overflow_error(
"Cannot convert ");
126 return static_cast<TargetType
>(value);
130 class on_scope_exit final
133 template <
typename Function> on_scope_exit(Function destructor_function)
134 try : func_(std::move(destructor_function))
139 destructor_function();
142 #ifdef EWS_HAS_DEFAULT_AND_DELETE 143 on_scope_exit() =
delete;
144 on_scope_exit(
const on_scope_exit&) =
delete;
145 on_scope_exit& operator=(
const on_scope_exit&) =
delete;
148 on_scope_exit(
const on_scope_exit&);
149 on_scope_exit& operator=(
const on_scope_exit&);
169 void release() EWS_NOEXCEPT { func_ =
nullptr; }
172 std::function<void(void)> func_;
175 #if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 176 defined(EWS_HAS_CXX17_STATIC_ASSERT) 177 static_assert(!std::is_copy_constructible<on_scope_exit>::value);
178 static_assert(!std::is_copy_assignable<on_scope_exit>::value);
179 static_assert(!std::is_move_constructible<on_scope_exit>::value);
180 static_assert(!std::is_move_assignable<on_scope_exit>::value);
181 static_assert(!std::is_default_constructible<on_scope_exit>::value);
184 #ifndef EWS_HAS_OPTIONAL 186 template <
typename T>
class optional final
188 # ifdef EWS_HAS_NON_BUGGY_TYPE_TRAITS 189 static_assert(std::is_copy_constructible<T>::value,
190 "T needs to be default constructible");
194 typedef T value_type;
196 optional() : value_set_(
false), val_() {}
198 template <
typename U>
199 optional(U&& val) : value_set_(
true), val_(std::forward<U>(val))
203 optional& operator=(T&& value)
205 val_ = std::move(value);
210 bool has_value()
const EWS_NOEXCEPT {
return value_set_; }
214 const T& value()
const 218 throw std::runtime_error(
"Bad ews::internal::optional access");
228 template <
typename T,
typename U>
229 inline bool operator==(
const optional<T>& opt,
const U& value)
231 return opt.has_value() ? opt.value() == value :
false;
268 inline const std::string& valid_chars()
270 static const auto chars = std::string(
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" 271 "abcdefghijklmnopqrstuvwxyz" 276 inline bool is_base64(
unsigned char c) EWS_NOEXCEPT
278 return isalnum(c) || (c ==
'+') || (c ==
'/');
281 inline std::string encode(
const std::vector<unsigned char>& buf)
283 const auto& base64_chars = valid_chars();
286 unsigned char char_array_3[3];
287 unsigned char char_array_4[4];
288 auto buflen = buf.size();
289 auto bufit = begin(buf);
294 char_array_3[i++] = *(bufit++);
297 char_array_4[0] = (char_array_3[0] & 0xfc) >> 2;
298 char_array_4[1] = ((char_array_3[0] & 0x03) << 4) +
299 ((char_array_3[1] & 0xf0) >> 4);
300 char_array_4[2] = ((char_array_3[1] & 0x0f) << 2) +
301 ((char_array_3[2] & 0xc0) >> 6);
302 char_array_4[3] = char_array_3[2] & 0x3f;
304 for (i = 0; (i < 4); i++)
306 ret += base64_chars[char_array_4[i]];
314 for (j = i; j < 3; j++)
316 char_array_3[j] =
'\0';
319 char_array_4[0] = (char_array_3[0] & 0xfc) >> 2;
320 char_array_4[1] = ((char_array_3[0] & 0x03) << 4) +
321 ((char_array_3[1] & 0xf0) >> 4);
322 char_array_4[2] = ((char_array_3[1] & 0x0f) << 2) +
323 ((char_array_3[2] & 0xc0) >> 6);
325 for (j = 0; (j < i + 1); j++)
327 ret += base64_chars[char_array_4[j]];
339 inline std::vector<unsigned char>
340 decode(
const std::string& encoded_string)
342 const auto& base64_chars = valid_chars();
343 auto in_len = encoded_string.size();
347 unsigned char char_array_4[4];
348 unsigned char char_array_3[3];
349 std::vector<unsigned char> ret;
351 while (in_len-- && (encoded_string[in] !=
'=') &&
352 is_base64(encoded_string[in]))
354 char_array_4[i++] = encoded_string[in];
359 for (i = 0; i < 4; i++)
361 char_array_4[i] =
static_cast<unsigned char>(
362 base64_chars.find(char_array_4[i]));
365 char_array_3[0] = (char_array_4[0] << 2) +
366 ((char_array_4[1] & 0x30) >> 4);
367 char_array_3[1] = ((char_array_4[1] & 0xf) << 4) +
368 ((char_array_4[2] & 0x3c) >> 2);
370 ((char_array_4[2] & 0x3) << 6) + char_array_4[3];
372 for (i = 0; (i < 3); i++)
374 ret.push_back(char_array_3[i]);
382 for (j = 0; j < i; j++)
384 char_array_4[j] =
static_cast<unsigned char>(
385 base64_chars.find(char_array_4[j]));
389 (char_array_4[0] << 2) + ((char_array_4[1] & 0x30) >> 4);
390 char_array_3[1] = ((char_array_4[1] & 0xf) << 4) +
391 ((char_array_4[2] & 0x3c) >> 2);
393 for (j = 0; (j < i - 1); j++)
395 ret.push_back(char_array_3[j]);
403 template <
typename T>
404 inline bool points_within_array(T* p, T* begin, T*
end)
407 return std::greater_equal<T*>()(p, begin) && std::less<T*>()(p, end);
431 explicit exception(
const std::string& what) : std::runtime_error(what) {}
432 explicit exception(
const char* what) : std::runtime_error(what) {}
450 #ifndef EWS_DOXYGEN_SHOULD_SKIP_THIS 451 static std::string error_message_from(
const rapidxml::parse_error& exc,
452 const std::vector<char>& xml)
454 using internal::points_within_array;
456 const auto what = std::string(exc.what());
457 const auto* where = exc.where<
char>();
459 if ((where ==
nullptr) || (*where ==
'\0'))
464 std::string msg = what;
467 const auto start = &xml[0];
468 if (points_within_array(where, start, (start + xml.size() + 1)))
470 enum {column_width = 79};
472 static_cast<size_t>(std::distance(start, where));
474 auto doc = std::string(start, xml.size());
478 begin(doc),
end(doc),
479 [&](
char c) ->
bool {
494 std::replace(begin(doc),
end(doc),
'\0',
'>');
497 doc = std::string(doc.data(), doc.length() - 1);
500 msg =
"in line " + std::to_string(lineno) +
":\n";
502 const auto pr = shorten(doc, idx, column_width);
503 const auto line = pr.first;
504 const auto line_index = pr.second;
507 auto squiggle = std::string(column_width,
' ');
508 squiggle[line_index] =
'~';
509 squiggle = remove_trailing_whitespace(squiggle);
510 msg += squiggle +
'\n';
518 #endif // EWS_DOXYGEN_SHOULD_SKIP_THIS 521 static std::string remove_trailing_whitespace(
const std::string& str)
523 static const auto whitespace = std::string(
" \t");
524 const auto end = str.find_last_not_of(whitespace);
525 return str.substr(0,
end + 1);
528 static std::pair<std::string, size_t> shorten(
const std::string& str,
529 size_t at,
size_t columns)
531 at = std::min(at, str.length());
532 if (str.length() < columns)
534 return std::make_pair(str, at);
537 const auto start =
std::max(at - (columns / 2), static_cast<size_t>(0));
538 const auto end = std::min(at + (columns / 2), str.length());
539 check((start <
end),
"Expected start to be before end");
541 std::copy(&str[start], &str[
end], std::back_inserter(line));
542 const auto line_index = columns / 2;
543 return std::make_pair(line, line_index);
2742 inline response_code str_to_response_code(
const std::string& str)
2744 if (str ==
"NoError")
2748 if (str ==
"ErrorAccessDenied")
2752 if (str ==
"ErrorAccessModeSpecified")
2756 if (str ==
"ErrorAccountDisabled")
2760 if (str ==
"ErrorAddDelegatesFailed")
2764 if (str ==
"ErrorAddressSpaceNotFound")
2768 if (str ==
"ErrorADOperation")
2772 if (str ==
"ErrorADSessionFilter")
2776 if (str ==
"ErrorADUnavailable")
2780 if (str ==
"ErrorAffectedTaskOccurrencesRequired")
2784 if (str ==
"ErrorArchiveFolderPathCreation")
2788 if (str ==
"ErrorArchiveMailboxNotEnabled")
2792 if (str ==
"ErrorArchiveMailboxServiceDiscoveryFailed")
2797 if (str ==
"ErrorAttachmentNestLevelLimitExceeded")
2801 if (str ==
"ErrorAttachmentSizeLimitExceeded")
2805 if (str ==
"ErrorAutoDiscoverFailed")
2809 if (str ==
"ErrorAvailabilityConfigNotFound")
2813 if (str ==
"ErrorBatchProcessingStopped")
2817 if (str ==
"ErrorCalendarCannotMoveOrCopyOccurrence")
2821 if (str ==
"ErrorCalendarCannotUpdateDeletedItem")
2825 if (str ==
"ErrorCalendarCannotUseIdForOccurrenceId")
2830 if (str ==
"ErrorCalendarCannotUseIdForRecurringMasterId")
2835 if (str ==
"ErrorCalendarDurationIsTooLong")
2839 if (str ==
"ErrorCalendarEndDateIsEarlierThanStartDate")
2844 if (str ==
"ErrorCalendarFolderIsInvalidForCalendarView")
2849 if (str ==
"ErrorCalendarInvalidAttributeValue")
2853 if (str ==
"ErrorCalendarInvalidDayForTimeChangePattern")
2858 if (str ==
"ErrorCalendarInvalidDayForWeeklyRecurrence")
2863 if (str ==
"ErrorCalendarInvalidPropertyState")
2867 if (str ==
"ErrorCalendarInvalidPropertyValue")
2871 if (str ==
"ErrorCalendarInvalidRecurrence")
2875 if (str ==
"ErrorCalendarInvalidTimeZone")
2879 if (str ==
"ErrorCalendarIsCancelledForAccept")
2883 if (str ==
"ErrorCalendarIsCancelledForDecline")
2887 if (str ==
"ErrorCalendarIsCancelledForRemove")
2891 if (str ==
"ErrorCalendarIsCancelledForTentative")
2895 if (str ==
"ErrorCalendarIsDelegatedForAccept")
2899 if (str ==
"ErrorCalendarIsDelegatedForDecline")
2903 if (str ==
"ErrorCalendarIsDelegatedForRemove")
2907 if (str ==
"ErrorCalendarIsDelegatedForTentative")
2911 if (str ==
"ErrorCalendarIsNotOrganizer")
2915 if (str ==
"ErrorCalendarIsOrganizerForAccept")
2919 if (str ==
"ErrorCalendarIsOrganizerForDecline")
2923 if (str ==
"ErrorCalendarIsOrganizerForRemove")
2927 if (str ==
"ErrorCalendarIsOrganizerForTentative")
2931 if (str ==
"ErrorCalendarMeetingRequestIsOutOfDate")
2935 if (str ==
"ErrorCalendarOccurrenceIndexIsOutOfRecurrenceRange")
2940 if (str ==
"ErrorCalendarOccurrenceIsDeletedFromRecurrence")
2945 if (str ==
"ErrorCalendarOutOfRange")
2949 if (str ==
"ErrorCalendarViewRangeTooBig")
2953 if (str ==
"ErrorCallerIsInvalidADAccount")
2957 if (str ==
"ErrorCannotArchiveCalendarContactTaskFolderException")
2962 if (str ==
"ErrorCannotArchiveItemsInPublicFolders")
2966 if (str ==
"ErrorCannotArchiveItemsInArchiveMailbox")
2970 if (str ==
"ErrorCannotCreateCalendarItemInNonCalendarFolder")
2975 if (str ==
"ErrorCannotCreateContactInNonContactFolder")
2980 if (str ==
"ErrorCannotCreatePostItemInNonMailFolder")
2985 if (str ==
"ErrorCannotCreateTaskInNonTaskFolder")
2989 if (str ==
"ErrorCannotDeleteObject")
2993 if (str ==
"ErrorCannotDeleteTaskOccurrence")
2997 if (str ==
"ErrorCannotDisableMandatoryExtension")
3001 if (str ==
"ErrorCannotEmptyFolder")
3005 if (str ==
"ErrorCannotGetSourceFolderPath")
3009 if (str ==
"ErrorCannotGetExternalEcpUrl")
3013 if (str ==
"ErrorCannotOpenFileAttachment")
3017 if (str ==
"ErrorCannotSetCalendarPermissionOnNonCalendarFolder")
3022 if (str ==
"ErrorCannotSetNonCalendarPermissionOnCalendarFolder")
3027 if (str ==
"ErrorCannotSetPermissionUnknownEntries")
3031 if (str ==
"ErrorCannotSpecifySearchFolderAsSourceFolder")
3036 if (str ==
"ErrorCannotUseFolderIdForItemId")
3040 if (str ==
"ErrorCannotUseItemIdForFolderId")
3044 if (str ==
"ErrorChangeKeyRequired")
3048 if (str ==
"ErrorChangeKeyRequiredForWriteOperations")
3053 if (str ==
"ErrorClientDisconnected")
3057 if (str ==
"ErrorClientIntentInvalidStateDefinition")
3061 if (str ==
"ErrorClientIntentNotFound")
3065 if (str ==
"ErrorConnectionFailed")
3069 if (str ==
"ErrorContainsFilterWrongType")
3073 if (str ==
"ErrorContentConversionFailed")
3077 if (str ==
"ErrorContentIndexingNotEnabled")
3081 if (str ==
"ErrorCorruptData")
3085 if (str ==
"ErrorCreateItemAccessDenied")
3089 if (str ==
"ErrorCreateManagedFolderPartialCompletion")
3094 if (str ==
"ErrorCreateSubfolderAccessDenied")
3098 if (str ==
"ErrorCrossMailboxMoveCopy")
3102 if (str ==
"ErrorCrossSiteRequest")
3106 if (str ==
"ErrorDataSizeLimitExceeded")
3110 if (str ==
"ErrorDataSourceOperation")
3114 if (str ==
"ErrorDelegateAlreadyExists")
3118 if (str ==
"ErrorDelegateCannotAddOwner")
3122 if (str ==
"ErrorDelegateMissingConfiguration")
3126 if (str ==
"ErrorDelegateNoUser")
3130 if (str ==
"ErrorDelegateValidationFailed")
3134 if (str ==
"ErrorDeleteDistinguishedFolder")
3138 if (str ==
"ErrorDeleteItemsFailed")
3142 if (str ==
"ErrorDeleteUnifiedMessagingPromptFailed")
3146 if (str ==
"ErrorDistinguishedUserNotSupported")
3150 if (str ==
"ErrorDistributionListMemberNotExist")
3154 if (str ==
"ErrorDuplicateInputFolderNames")
3158 if (str ==
"ErrorDuplicateUserIdsSpecified")
3162 if (str ==
"ErrorEmailAddressMismatch")
3166 if (str ==
"ErrorEventNotFound")
3170 if (str ==
"ErrorExceededConnectionCount")
3174 if (str ==
"ErrorExceededSubscriptionCount")
3178 if (str ==
"ErrorExceededFindCountLimit")
3182 if (str ==
"ErrorExpiredSubscription")
3186 if (str ==
"ErrorExtensionNotFound")
3190 if (str ==
"ErrorFolderCorrupt")
3194 if (str ==
"ErrorFolderExists")
3198 if (str ==
"ErrorFolderNotFound")
3202 if (str ==
"ErrorFolderPropertyRequestFailed")
3206 if (str ==
"ErrorFolderSave")
3210 if (str ==
"ErrorFolderSaveFailed")
3214 if (str ==
"ErrorFolderSavePropertyError")
3218 if (str ==
"ErrorFreeBusyGenerationFailed")
3222 if (str ==
"ErrorGetServerSecurityDescriptorFailed")
3226 if (str ==
"ErrorImContactLimitReached")
3230 if (str ==
"ErrorImGroupDisplayNameAlreadyExists")
3234 if (str ==
"ErrorImGroupLimitReached")
3238 if (str ==
"ErrorImpersonateUserDenied")
3242 if (str ==
"ErrorImpersonationDenied")
3246 if (str ==
"ErrorImpersonationFailed")
3250 if (str ==
"ErrorIncorrectSchemaVersion")
3254 if (str ==
"ErrorIncorrectUpdatePropertyCount")
3258 if (str ==
"ErrorIndividualMailboxLimitReached")
3262 if (str ==
"ErrorInsufficientResources")
3266 if (str ==
"ErrorInternalServerError")
3270 if (str ==
"ErrorInternalServerTransientError")
3274 if (str ==
"ErrorInvalidAccessLevel")
3278 if (str ==
"ErrorInvalidArgument")
3282 if (str ==
"ErrorInvalidAttachmentId")
3286 if (str ==
"ErrorInvalidAttachmentSubfilter")
3290 if (str ==
"ErrorInvalidAttachmentSubfilterTextFilter")
3295 if (str ==
"ErrorInvalidAuthorizationContext")
3299 if (str ==
"ErrorInvalidChangeKey")
3303 if (str ==
"ErrorInvalidClientSecurityContext")
3307 if (str ==
"ErrorInvalidCompleteDate")
3311 if (str ==
"ErrorInvalidContactEmailAddress")
3315 if (str ==
"ErrorInvalidContactEmailIndex")
3319 if (str ==
"ErrorInvalidCrossForestCredentials")
3323 if (str ==
"ErrorInvalidDelegatePermission")
3327 if (str ==
"ErrorInvalidDelegateUserId")
3331 if (str ==
"ErrorInvalidExchangeImpersonationHeaderData")
3336 if (str ==
"ErrorInvalidExcludesRestriction")
3340 if (str ==
"ErrorInvalidExpressionTypeForSubFilter")
3344 if (str ==
"ErrorInvalidExtendedProperty")
3348 if (str ==
"ErrorInvalidExtendedPropertyValue")
3352 if (str ==
"ErrorInvalidExternalSharingInitiator")
3356 if (str ==
"ErrorInvalidExternalSharingSubscriber")
3360 if (str ==
"ErrorInvalidFederatedOrganizationId")
3364 if (str ==
"ErrorInvalidFolderId")
3368 if (str ==
"ErrorInvalidFolderTypeForOperation")
3372 if (str ==
"ErrorInvalidFractionalPagingParameters")
3376 if (str ==
"ErrorInvalidGetSharingFolderRequest")
3380 if (str ==
"ErrorInvalidFreeBusyViewType")
3384 if (str ==
"ErrorInvalidId")
3388 if (str ==
"ErrorInvalidIdEmpty")
3392 if (str ==
"ErrorInvalidLikeRequest")
3396 if (str ==
"ErrorInvalidIdMalformed")
3400 if (str ==
"ErrorInvalidIdMalformedEwsLegacyIdFormat")
3405 if (str ==
"ErrorInvalidIdMonikerTooLong")
3409 if (str ==
"ErrorInvalidIdNotAnItemAttachmentId")
3413 if (str ==
"ErrorInvalidIdReturnedByResolveNames")
3417 if (str ==
"ErrorInvalidIdStoreObjectIdTooLong")
3421 if (str ==
"ErrorInvalidIdTooManyAttachmentLevels")
3425 if (str ==
"ErrorInvalidIdXml")
3429 if (str ==
"ErrorInvalidImContactId")
3433 if (str ==
"ErrorInvalidImDistributionGroupSmtpAddress")
3438 if (str ==
"ErrorInvalidImGroupId")
3442 if (str ==
"ErrorInvalidIndexedPagingParameters")
3446 if (str ==
"ErrorInvalidInternetHeaderChildNodes")
3450 if (str ==
"ErrorInvalidItemForOperationArchiveItem")
3454 if (str ==
"ErrorInvalidItemForOperationAcceptItem")
3458 if (str ==
"ErrorInvalidItemForOperationCancelItem")
3462 if (str ==
"ErrorInvalidItemForOperationCreateItemAttachment")
3467 if (str ==
"ErrorInvalidItemForOperationCreateItem")
3471 if (str ==
"ErrorInvalidItemForOperationDeclineItem")
3475 if (str ==
"ErrorInvalidItemForOperationExpandDL")
3479 if (str ==
"ErrorInvalidItemForOperationRemoveItem")
3483 if (str ==
"ErrorInvalidItemForOperationSendItem")
3487 if (str ==
"ErrorInvalidItemForOperationTentative")
3491 if (str ==
"ErrorInvalidLogonType")
3495 if (str ==
"ErrorInvalidMailbox")
3499 if (str ==
"ErrorInvalidManagedFolderProperty")
3503 if (str ==
"ErrorInvalidManagedFolderQuota")
3507 if (str ==
"ErrorInvalidManagedFolderSize")
3511 if (str ==
"ErrorInvalidMergedFreeBusyInterval")
3515 if (str ==
"ErrorInvalidNameForNameResolution")
3519 if (str ==
"ErrorInvalidNetworkServiceContext")
3523 if (str ==
"ErrorInvalidOofParameter")
3527 if (str ==
"ErrorInvalidOperation")
3531 if (str ==
"ErrorInvalidOrganizationRelationshipForFreeBusy")
3536 if (str ==
"ErrorInvalidPagingMaxRows")
3540 if (str ==
"ErrorInvalidParentFolder")
3544 if (str ==
"ErrorInvalidPercentCompleteValue")
3548 if (str ==
"ErrorInvalidPermissionSettings")
3552 if (str ==
"ErrorInvalidPhoneCallId")
3556 if (str ==
"ErrorInvalidPhoneNumber")
3560 if (str ==
"ErrorInvalidPropertyAppend")
3564 if (str ==
"ErrorInvalidPropertyDelete")
3568 if (str ==
"ErrorInvalidPropertyForExists")
3572 if (str ==
"ErrorInvalidPropertyForOperation")
3576 if (str ==
"ErrorInvalidPropertyRequest")
3580 if (str ==
"ErrorInvalidPropertySet")
3584 if (str ==
"ErrorInvalidPropertyUpdateSentMessage")
3588 if (str ==
"ErrorInvalidProxySecurityContext")
3592 if (str ==
"ErrorInvalidPullSubscriptionId")
3596 if (str ==
"ErrorInvalidPushSubscriptionUrl")
3600 if (str ==
"ErrorInvalidRecipients")
3604 if (str ==
"ErrorInvalidRecipientSubfilter")
3608 if (str ==
"ErrorInvalidRecipientSubfilterComparison")
3612 if (str ==
"ErrorInvalidRecipientSubfilterOrder")
3616 if (str ==
"ErrorInvalidRecipientSubfilterTextFilter")
3620 if (str ==
"ErrorInvalidReferenceItem")
3624 if (str ==
"ErrorInvalidRequest")
3628 if (str ==
"ErrorInvalidRestriction")
3632 if (str ==
"ErrorInvalidRetentionTagTypeMismatch")
3636 if (str ==
"ErrorInvalidRetentionTagInvisible")
3640 if (str ==
"ErrorInvalidRetentionTagInheritance")
3644 if (str ==
"ErrorInvalidRetentionTagIdGuid")
3648 if (str ==
"ErrorInvalidRoutingType")
3652 if (str ==
"ErrorInvalidScheduledOofDuration")
3656 if (str ==
"ErrorInvalidSchemaVersionForMailboxVersion")
3661 if (str ==
"ErrorInvalidSecurityDescriptor")
3665 if (str ==
"ErrorInvalidSendItemSaveSettings")
3669 if (str ==
"ErrorInvalidSerializedAccessToken")
3673 if (str ==
"ErrorInvalidSharingData")
3677 if (str ==
"ErrorInvalidSharingMessage")
3681 if (str ==
"ErrorInvalidSid")
3685 if (str ==
"ErrorInvalidSIPUri")
3689 if (str ==
"ErrorInvalidServerVersion")
3693 if (str ==
"ErrorInvalidSmtpAddress")
3697 if (str ==
"ErrorInvalidSubfilterType")
3701 if (str ==
"ErrorInvalidSubfilterTypeNotAttendeeType")
3706 if (str ==
"ErrorInvalidSubfilterTypeNotRecipientType")
3711 if (str ==
"ErrorInvalidSubscription")
3715 if (str ==
"ErrorInvalidSubscriptionRequest")
3719 if (str ==
"ErrorInvalidSyncStateData")
3723 if (str ==
"ErrorInvalidTimeInterval")
3727 if (str ==
"ErrorInvalidUserInfo")
3731 if (str ==
"ErrorInvalidUserOofSettings")
3735 if (str ==
"ErrorInvalidUserPrincipalName")
3739 if (str ==
"ErrorInvalidUserSid")
3743 if (str ==
"ErrorInvalidUserSidMissingUPN")
3747 if (str ==
"ErrorInvalidValueForProperty")
3751 if (str ==
"ErrorInvalidWatermark")
3755 if (str ==
"ErrorIPGatewayNotFound")
3759 if (str ==
"ErrorIrresolvableConflict")
3763 if (str ==
"ErrorItemCorrupt")
3767 if (str ==
"ErrorItemNotFound")
3771 if (str ==
"ErrorItemPropertyRequestFailed")
3775 if (str ==
"ErrorItemSave")
3779 if (str ==
"ErrorItemSavePropertyError")
3783 if (str ==
"ErrorLegacyMailboxFreeBusyViewTypeNotMerged")
3788 if (str ==
"ErrorLocalServerObjectNotFound")
3792 if (str ==
"ErrorLogonAsNetworkServiceFailed")
3796 if (str ==
"ErrorMailboxConfiguration")
3800 if (str ==
"ErrorMailboxDataArrayEmpty")
3804 if (str ==
"ErrorMailboxDataArrayTooBig")
3808 if (str ==
"ErrorMailboxFailover")
3812 if (str ==
"ErrorMailboxHoldNotFound")
3816 if (str ==
"ErrorMailboxLogonFailed")
3820 if (str ==
"ErrorMailboxMoveInProgress")
3824 if (str ==
"ErrorMailboxStoreUnavailable")
3828 if (str ==
"ErrorMailRecipientNotFound")
3832 if (str ==
"ErrorMailTipsDisabled")
3836 if (str ==
"ErrorManagedFolderAlreadyExists")
3840 if (str ==
"ErrorManagedFolderNotFound")
3844 if (str ==
"ErrorManagedFoldersRootFailure")
3848 if (str ==
"ErrorMeetingSuggestionGenerationFailed")
3852 if (str ==
"ErrorMessageDispositionRequired")
3856 if (str ==
"ErrorMessageSizeExceeded")
3860 if (str ==
"ErrorMessageTrackingNoSuchDomain")
3864 if (str ==
"ErrorMessageTrackingPermanentError")
3868 if (str ==
" ErrorMessageTrackingTransientError")
3872 if (str ==
"ErrorMimeContentConversionFailed")
3876 if (str ==
"ErrorMimeContentInvalid")
3880 if (str ==
"ErrorMimeContentInvalidBase64String")
3884 if (str ==
"ErrorMissingArgument")
3888 if (str ==
"ErrorMissingEmailAddress")
3892 if (str ==
"ErrorMissingEmailAddressForManagedFolder")
3897 if (str ==
"ErrorMissingInformationEmailAddress")
3901 if (str ==
"ErrorMissingInformationReferenceItemId")
3905 if (str ==
"ErrorMissingItemForCreateItemAttachment")
3909 if (str ==
"ErrorMissingManagedFolderId")
3913 if (str ==
"ErrorMissingRecipients")
3917 if (str ==
"ErrorMissingUserIdInformation")
3921 if (str ==
"ErrorMoreThanOneAccessModeSpecified")
3925 if (str ==
"ErrorMoveCopyFailed")
3929 if (str ==
"ErrorMoveDistinguishedFolder")
3933 if (str ==
"ErrorMultiLegacyMailboxAccess")
3937 if (str ==
"ErrorNameResolutionMultipleResults")
3941 if (str ==
"ErrorNameResolutionNoMailbox")
3945 if (str ==
"ErrorNameResolutionNoResults")
3949 if (str ==
"ErrorNoApplicableProxyCASServersAvailable")
3954 if (str ==
"ErrorNoCalendar")
3958 if (str ==
"ErrorNoDestinationCASDueToKerberosRequirements")
3963 if (str ==
"ErrorNoDestinationCASDueToSSLRequirements")
3968 if (str ==
"ErrorNoDestinationCASDueToVersionMismatch")
3973 if (str ==
"ErrorNoFolderClassOverride")
3977 if (str ==
"ErrorNoFreeBusyAccess")
3981 if (str ==
"ErrorNonExistentMailbox")
3985 if (str ==
"ErrorNonPrimarySmtpAddress")
3989 if (str ==
"ErrorNoPropertyTagForCustomProperties")
3993 if (str ==
"ErrorNoPublicFolderReplicaAvailable")
3997 if (str ==
"ErrorNoPublicFolderServerAvailable")
4001 if (str ==
"ErrorNoRespondingCASInDestinationSite")
4005 if (str ==
"ErrorNotDelegate")
4009 if (str ==
"ErrorNotEnoughMemory")
4013 if (str ==
"ErrorNotSupportedSharingMessage")
4017 if (str ==
"ErrorObjectTypeChanged")
4021 if (str ==
"ErrorOccurrenceCrossingBoundary")
4025 if (str ==
"ErrorOccurrenceTimeSpanTooBig")
4029 if (str ==
"ErrorOperationNotAllowedWithPublicFolderRoot")
4034 if (str ==
"ErrorOrganizationNotFederated")
4038 if (str ==
"ErrorParentFolderIdRequired")
4042 if (str ==
"ErrorParentFolderNotFound")
4046 if (str ==
"ErrorPasswordChangeRequired")
4050 if (str ==
"ErrorPasswordExpired")
4054 if (str ==
"ErrorPermissionNotAllowedByPolicy")
4058 if (str ==
"ErrorPhoneNumberNotDialable")
4062 if (str ==
"ErrorPropertyUpdate")
4066 if (str ==
"ErrorPromptPublishingOperationFailed")
4070 if (str ==
"ErrorPropertyValidationFailure")
4074 if (str ==
"ErrorProxiedSubscriptionCallFailure")
4078 if (str ==
"ErrorProxyCallFailed")
4082 if (str ==
"ErrorProxyGroupSidLimitExceeded")
4086 if (str ==
"ErrorProxyRequestNotAllowed")
4090 if (str ==
"ErrorProxyRequestProcessingFailed")
4094 if (str ==
"ErrorProxyServiceDiscoveryFailed")
4098 if (str ==
"ErrorProxyTokenExpired")
4102 if (str ==
"ErrorPublicFolderMailboxDiscoveryFailed")
4106 if (str ==
"ErrorPublicFolderOperationFailed")
4110 if (str ==
"ErrorPublicFolderRequestProcessingFailed")
4114 if (str ==
"ErrorPublicFolderServerNotFound")
4118 if (str ==
"ErrorPublicFolderSyncException")
4122 if (str ==
"ErrorQueryFilterTooLong")
4126 if (str ==
"ErrorQuotaExceeded")
4130 if (str ==
"ErrorReadEventsFailed")
4134 if (str ==
"ErrorReadReceiptNotPending")
4138 if (str ==
"ErrorRecurrenceEndDateTooBig")
4142 if (str ==
"ErrorRecurrenceHasNoOccurrence")
4146 if (str ==
"ErrorRemoveDelegatesFailed")
4150 if (str ==
"ErrorRequestAborted")
4154 if (str ==
"ErrorRequestStreamTooBig")
4158 if (str ==
"ErrorRequiredPropertyMissing")
4162 if (str ==
"ErrorResolveNamesInvalidFolderType")
4166 if (str ==
"ErrorResolveNamesOnlyOneContactsFolderAllowed")
4171 if (str ==
"ErrorResponseSchemaValidation")
4175 if (str ==
"ErrorRestrictionTooLong")
4179 if (str ==
"ErrorRestrictionTooComplex")
4183 if (str ==
"ErrorResultSetTooBig")
4187 if (str ==
"ErrorSavedItemFolderNotFound")
4191 if (str ==
"ErrorSchemaValidation")
4195 if (str ==
"ErrorSearchFolderNotInitialized")
4199 if (str ==
"ErrorSendAsDenied")
4203 if (str ==
"ErrorSendMeetingCancellationsRequired")
4207 if (str ==
"ErrorSendMeetingInvitationsOrCancellationsRequired")
4212 if (str ==
"ErrorSendMeetingInvitationsRequired")
4216 if (str ==
"ErrorSentMeetingRequestUpdate")
4220 if (str ==
"ErrorSentTaskRequestUpdate")
4224 if (str ==
"ErrorServerBusy")
4228 if (str ==
"ErrorServiceDiscoveryFailed")
4232 if (str ==
"ErrorStaleObject")
4236 if (str ==
"ErrorSubmissionQuotaExceeded")
4240 if (str ==
"ErrorSubscriptionAccessDenied")
4244 if (str ==
"ErrorSubscriptionDelegateAccessNotSupported")
4249 if (str ==
"ErrorSubscriptionNotFound")
4253 if (str ==
"ErrorSubscriptionUnsubscribed")
4257 if (str ==
"ErrorSyncFolderNotFound")
4261 if (str ==
"ErrorTeamMailboxNotFound")
4265 if (str ==
"ErrorTeamMailboxNotLinkedToSharePoint")
4269 if (str ==
"ErrorTeamMailboxUrlValidationFailed")
4273 if (str ==
"ErrorTeamMailboxNotAuthorizedOwner")
4277 if (str ==
"ErrorTeamMailboxActiveToPendingDelete")
4281 if (str ==
"ErrorTeamMailboxFailedSendingNotifications")
4286 if (str ==
"ErrorTeamMailboxErrorUnknown")
4290 if (str ==
"ErrorTimeIntervalTooBig")
4294 if (str ==
"ErrorTimeoutExpired")
4298 if (str ==
"ErrorTimeZone")
4302 if (str ==
"ErrorToFolderNotFound")
4306 if (str ==
"ErrorTokenSerializationDenied")
4310 if (str ==
"ErrorTooManyObjectsOpened")
4314 if (str ==
"ErrorUnifiedMessagingDialPlanNotFound")
4318 if (str ==
"ErrorUnifiedMessagingReportDataNotFound")
4322 if (str ==
"ErrorUnifiedMessagingPromptNotFound")
4326 if (str ==
"ErrorUnifiedMessagingRequestFailed")
4330 if (str ==
"ErrorUnifiedMessagingServerNotFound")
4334 if (str ==
"ErrorUnableToGetUserOofSettings")
4338 if (str ==
"ErrorUnableToRemoveImContactFromGroup")
4342 if (str ==
"ErrorUnsupportedCulture")
4346 if (str ==
"ErrorUnsupportedMapiPropertyType")
4350 if (str ==
"ErrorUnsupportedMimeConversion")
4354 if (str ==
"ErrorUnsupportedPathForQuery")
4358 if (str ==
"ErrorUnsupportedPathForSortGroup")
4362 if (str ==
"ErrorUnsupportedPropertyDefinition")
4366 if (str ==
"ErrorUnsupportedQueryFilter")
4370 if (str ==
"ErrorUnsupportedRecurrence")
4374 if (str ==
"ErrorUnsupportedSubFilter")
4378 if (str ==
"ErrorUnsupportedTypeForConversion")
4382 if (str ==
"ErrorUpdateDelegatesFailed")
4386 if (str ==
"ErrorUpdatePropertyMismatch")
4390 if (str ==
"ErrorUserNotUnifiedMessagingEnabled")
4394 if (str ==
"ErrorUserNotAllowedByPolicy")
4398 if (str ==
"ErrorUserWithoutFederatedProxyAddress")
4402 if (str ==
"ErrorValueOutOfRange")
4406 if (str ==
"ErrorVirusDetected")
4410 if (str ==
"ErrorVirusMessageDeleted")
4414 if (str ==
"ErrorVoiceMailNotImplemented")
4418 if (str ==
"ErrorWebRequestInInvalidState")
4422 if (str ==
"ErrorWin32InteropError")
4426 if (str ==
"ErrorWorkingHoursSaveFailed")
4430 if (str ==
"ErrorWorkingHoursXmlMalformed")
4434 if (str ==
"ErrorWrongServerVersion")
4438 if (str ==
"ErrorWrongServerVersionDelegate")
4442 if (str ==
"ErrorMissingInformationSharingFolderId")
4446 if (str ==
"ErrorDuplicateSOAPHeader")
4450 if (str ==
"ErrorSharingSynchronizationFailed")
4454 if (str ==
"ErrorSharingNoExternalEwsAvailable")
4458 if (str ==
"ErrorFreeBusyDLLimitReached")
4462 if (str ==
"ErrorNotAllowedExternalSharingByPolicy")
4466 if (str ==
"ErrorMessageTrackingTransientError")
4470 if (str ==
"ErrorApplyConversationActionFailed")
4474 if (str ==
"ErrorInboxRulesValidationError")
4478 if (str ==
"ErrorOutlookRuleBlobExists")
4482 if (str ==
"ErrorRulesOverQuota")
4486 if (str ==
"ErrorNewEventStreamConnectionOpened")
4490 if (str ==
"ErrorMissedNotificationEvents")
4494 if (str ==
"ErrorDuplicateLegacyDistinguishedName")
4498 if (str ==
"ErrorInvalidClientAccessTokenRequest")
4502 if (str ==
"ErrorNoSpeechDetected")
4506 if (str ==
"ErrorUMServerUnavailable")
4510 if (str ==
"ErrorRecipientNotFound")
4514 if (str ==
"ErrorRecognizerNotInstalled")
4518 if (str ==
"ErrorSpeechGrammarError")
4522 if (str ==
"ErrorInvalidManagementRoleHeader")
4526 if (str ==
"ErrorLocationServicesDisabled")
4530 if (str ==
"ErrorLocationServicesRequestTimedOut")
4534 if (str ==
"ErrorLocationServicesRequestFailed")
4538 if (str ==
"ErrorLocationServicesInvalidRequest")
4542 if (str ==
"ErrorWeatherServiceDisabled")
4546 if (str ==
"ErrorMailboxScopeNotAllowedWithoutQueryString")
4551 if (str ==
"ErrorArchiveMailboxSearchFailed")
4555 if (str ==
"ErrorGetRemoteArchiveFolderFailed")
4559 if (str ==
"ErrorFindRemoteArchiveFolderFailed")
4563 if (str ==
"ErrorGetRemoteArchiveItemFailed")
4567 if (str ==
"ErrorExportRemoteArchiveItemsFailed")
4571 if (str ==
"ErrorInvalidPhotoSize")
4575 if (str ==
"ErrorSearchQueryHasTooManyKeywords")
4579 if (str ==
"ErrorSearchTooManyMailboxes")
4583 if (str ==
"ErrorInvalidRetentionTagNone")
4587 if (str ==
"ErrorDiscoverySearchesDisabled")
4591 if (str ==
"ErrorCalendarSeekToConditionNotSupported")
4596 if (str ==
"ErrorCalendarIsGroupMailboxForAccept")
4600 if (str ==
"ErrorCalendarIsGroupMailboxForDecline")
4604 if (str ==
"ErrorCalendarIsGroupMailboxForTentative")
4608 if (str ==
"ErrorCalendarIsGroupMailboxForSuppressReadReceipt")
4613 if (str ==
"ErrorOrganizationAccessBlocked")
4617 if (str ==
"ErrorInvalidLicense")
4621 if (str ==
"ErrorMessagePerFolderCountReceiveQuotaExceeded")
4626 throw exception(
"Unrecognized response code: " + str);
4636 return "ErrorAccessDenied";
4638 return "ErrorAccessModeSpecified";
4640 return "ErrorAccountDisabled";
4642 return "ErrorAddDelegatesFailed";
4644 return "ErrorAddressSpaceNotFound";
4646 return "ErrorADOperation";
4648 return "ErrorADSessionFilter";
4650 return "ErrorADUnavailable";
4652 return "ErrorAffectedTaskOccurrencesRequired";
4654 return "ErrorArchiveFolderPathCreation";
4656 return "ErrorArchiveMailboxNotEnabled";
4658 return "ErrorArchiveMailboxServiceDiscoveryFailed";
4660 return "ErrorAttachmentNestLevelLimitExceeded";
4662 return "ErrorAttachmentSizeLimitExceeded";
4664 return "ErrorAutoDiscoverFailed";
4666 return "ErrorAvailabilityConfigNotFound";
4668 return "ErrorBatchProcessingStopped";
4670 return "ErrorCalendarCannotMoveOrCopyOccurrence";
4672 return "ErrorCalendarCannotUpdateDeletedItem";
4674 return "ErrorCalendarCannotUseIdForOccurrenceId";
4677 return "ErrorCalendarCannotUseIdForRecurringMasterId";
4679 return "ErrorCalendarDurationIsTooLong";
4681 return "ErrorCalendarEndDateIsEarlierThanStartDate";
4683 return "ErrorCalendarFolderIsInvalidForCalendarView";
4685 return "ErrorCalendarInvalidAttributeValue";
4687 return "ErrorCalendarInvalidDayForTimeChangePattern";
4689 return "ErrorCalendarInvalidDayForWeeklyRecurrence";
4691 return "ErrorCalendarInvalidPropertyState";
4693 return "ErrorCalendarInvalidPropertyValue";
4695 return "ErrorCalendarInvalidRecurrence";
4697 return "ErrorCalendarInvalidTimeZone";
4699 return "ErrorCalendarIsCancelledForAccept";
4701 return "ErrorCalendarIsCancelledForDecline";
4703 return "ErrorCalendarIsCancelledForRemove";
4705 return "ErrorCalendarIsCancelledForTentative";
4707 return "ErrorCalendarIsDelegatedForAccept";
4709 return "ErrorCalendarIsDelegatedForDecline";
4711 return "ErrorCalendarIsDelegatedForRemove";
4713 return "ErrorCalendarIsDelegatedForTentative";
4715 return "ErrorCalendarIsNotOrganizer";
4717 return "ErrorCalendarIsOrganizerForAccept";
4719 return "ErrorCalendarIsOrganizerForDecline";
4721 return "ErrorCalendarIsOrganizerForRemove";
4723 return "ErrorCalendarIsOrganizerForTentative";
4725 return "ErrorCalendarMeetingRequestIsOutOfDate";
4728 return "ErrorCalendarOccurrenceIndexIsOutOfRecurrenceRange";
4731 return "ErrorCalendarOccurrenceIsDeletedFromRecurrence";
4733 return "ErrorCalendarOutOfRange";
4735 return "ErrorCalendarViewRangeTooBig";
4737 return "ErrorCallerIsInvalidADAccount";
4740 return "ErrorCannotArchiveCalendarContactTaskFolderException";
4742 return "ErrorCannotArchiveItemsInPublicFolders";
4744 return "ErrorCannotArchiveItemsInArchiveMailbox";
4747 return "ErrorCannotCreateCalendarItemInNonCalendarFolder";
4749 return "ErrorCannotCreateContactInNonContactFolder";
4751 return "ErrorCannotCreatePostItemInNonMailFolder";
4753 return "ErrorCannotCreateTaskInNonTaskFolder";
4755 return "ErrorCannotDeleteObject";
4757 return "ErrorCannotDeleteTaskOccurrence";
4759 return "ErrorCannotDisableMandatoryExtension";
4761 return "ErrorCannotEmptyFolder";
4763 return "ErrorCannotGetSourceFolderPath";
4765 return "ErrorCannotGetExternalEcpUrl";
4767 return "ErrorCannotOpenFileAttachment";
4770 return "ErrorCannotSetCalendarPermissionOnNonCalendarFolder";
4773 return "ErrorCannotSetNonCalendarPermissionOnCalendarFolder";
4775 return "ErrorCannotSetPermissionUnknownEntries";
4777 return "ErrorCannotSpecifySearchFolderAsSourceFolder";
4779 return "ErrorCannotUseFolderIdForItemId";
4781 return "ErrorCannotUseItemIdForFolderId";
4783 return "ErrorChangeKeyRequired";
4785 return "ErrorChangeKeyRequiredForWriteOperations";
4787 return "ErrorClientDisconnected";
4789 return "ErrorClientIntentInvalidStateDefinition";
4791 return "ErrorClientIntentNotFound";
4793 return "ErrorConnectionFailed";
4795 return "ErrorContainsFilterWrongType";
4797 return "ErrorContentConversionFailed";
4799 return "ErrorContentIndexingNotEnabled";
4801 return "ErrorCorruptData";
4803 return "ErrorCreateItemAccessDenied";
4805 return "ErrorCreateManagedFolderPartialCompletion";
4807 return "ErrorCreateSubfolderAccessDenied";
4809 return "ErrorCrossMailboxMoveCopy";
4811 return "ErrorCrossSiteRequest";
4813 return "ErrorDataSizeLimitExceeded";
4815 return "ErrorDataSourceOperation";
4817 return "ErrorDelegateAlreadyExists";
4819 return "ErrorDelegateCannotAddOwner";
4821 return "ErrorDelegateMissingConfiguration";
4823 return "ErrorDelegateNoUser";
4825 return "ErrorDelegateValidationFailed";
4827 return "ErrorDeleteDistinguishedFolder";
4829 return "ErrorDeleteItemsFailed";
4831 return "ErrorDeleteUnifiedMessagingPromptFailed";
4833 return "ErrorDistinguishedUserNotSupported";
4835 return "ErrorDistributionListMemberNotExist";
4837 return "ErrorDuplicateInputFolderNames";
4839 return "ErrorDuplicateUserIdsSpecified";
4841 return "ErrorEmailAddressMismatch";
4843 return "ErrorEventNotFound";
4845 return "ErrorExceededConnectionCount";
4847 return "ErrorExceededSubscriptionCount";
4849 return "ErrorExceededFindCountLimit";
4851 return "ErrorExpiredSubscription";
4853 return "ErrorExtensionNotFound";
4855 return "ErrorFolderCorrupt";
4857 return "ErrorFolderExists";
4859 return "ErrorFolderNotFound";
4861 return "ErrorFolderPropertyRequestFailed";
4863 return "ErrorFolderSave";
4865 return "ErrorFolderSaveFailed";
4867 return "ErrorFolderSavePropertyError";
4869 return "ErrorFreeBusyGenerationFailed";
4871 return "ErrorGetServerSecurityDescriptorFailed";
4873 return "ErrorImContactLimitReached";
4875 return "ErrorImGroupDisplayNameAlreadyExists";
4877 return "ErrorImGroupLimitReached";
4879 return "ErrorImpersonateUserDenied";
4881 return "ErrorImpersonationDenied";
4883 return "ErrorImpersonationFailed";
4885 return "ErrorIncorrectSchemaVersion";
4887 return "ErrorIncorrectUpdatePropertyCount";
4889 return "ErrorIndividualMailboxLimitReached";
4891 return "ErrorInsufficientResources";
4893 return "ErrorInternalServerError";
4895 return "ErrorInternalServerTransientError";
4897 return "ErrorInvalidAccessLevel";
4899 return "ErrorInvalidArgument";
4901 return "ErrorInvalidAttachmentId";
4903 return "ErrorInvalidAttachmentSubfilter";
4905 return "ErrorInvalidAttachmentSubfilterTextFilter";
4907 return "ErrorInvalidAuthorizationContext";
4909 return "ErrorInvalidChangeKey";
4911 return "ErrorInvalidClientSecurityContext";
4913 return "ErrorInvalidCompleteDate";
4915 return "ErrorInvalidContactEmailAddress";
4917 return "ErrorInvalidContactEmailIndex";
4919 return "ErrorInvalidCrossForestCredentials";
4921 return "ErrorInvalidDelegatePermission";
4923 return "ErrorInvalidDelegateUserId";
4925 return "ErrorInvalidExchangeImpersonationHeaderData";
4927 return "ErrorInvalidExcludesRestriction";
4929 return "ErrorInvalidExpressionTypeForSubFilter";
4931 return "ErrorInvalidExtendedProperty";
4933 return "ErrorInvalidExtendedPropertyValue";
4935 return "ErrorInvalidExternalSharingInitiator";
4937 return "ErrorInvalidExternalSharingSubscriber";
4939 return "ErrorInvalidFederatedOrganizationId";
4941 return "ErrorInvalidFolderId";
4943 return "ErrorInvalidFolderTypeForOperation";
4945 return "ErrorInvalidFractionalPagingParameters";
4947 return "ErrorInvalidFreeBusyViewType";
4949 return "ErrorInvalidId";
4951 return "ErrorInvalidIdEmpty";
4953 return "ErrorInvalidLikeRequest";
4955 return "ErrorInvalidIdMalformed";
4957 return "ErrorInvalidIdMalformedEwsLegacyIdFormat";
4959 return "ErrorInvalidIdMonikerTooLong";
4961 return "ErrorInvalidIdNotAnItemAttachmentId";
4963 return "ErrorInvalidIdReturnedByResolveNames";
4965 return "ErrorInvalidIdStoreObjectIdTooLong";
4967 return "ErrorInvalidIdTooManyAttachmentLevels";
4969 return "ErrorInvalidIdXml";
4971 return "ErrorInvalidImContactId";
4973 return "ErrorInvalidImDistributionGroupSmtpAddress";
4975 return "ErrorInvalidImGroupId";
4977 return "ErrorInvalidIndexedPagingParameters";
4979 return "ErrorInvalidInternetHeaderChildNodes";
4981 return "ErrorInvalidItemForOperationArchiveItem";
4983 return "ErrorInvalidItemForOperationAcceptItem";
4985 return "ErrorInvalidItemForOperationCancelItem";
4988 return "ErrorInvalidItemForOperationCreateItemAttachment";
4990 return "ErrorInvalidItemForOperationCreateItem";
4992 return "ErrorInvalidItemForOperationDeclineItem";
4994 return "ErrorInvalidItemForOperationExpandDL";
4996 return "ErrorInvalidItemForOperationRemoveItem";
4998 return "ErrorInvalidItemForOperationSendItem";
5000 return "ErrorInvalidItemForOperationTentative";
5002 return "ErrorInvalidLogonType";
5004 return "ErrorInvalidMailbox";
5006 return "ErrorInvalidManagedFolderProperty";
5008 return "ErrorInvalidManagedFolderQuota";
5010 return "ErrorInvalidManagedFolderSize";
5012 return "ErrorInvalidMergedFreeBusyInterval";
5014 return "ErrorInvalidNameForNameResolution";
5016 return "ErrorInvalidNetworkServiceContext";
5018 return "ErrorInvalidOofParameter";
5020 return "ErrorInvalidOperation";
5023 return "ErrorInvalidOrganizationRelationshipForFreeBusy";
5025 return "ErrorInvalidPagingMaxRows";
5027 return "ErrorInvalidParentFolder";
5029 return "ErrorInvalidPercentCompleteValue";
5031 return "ErrorInvalidPermissionSettings";
5033 return "ErrorInvalidPhoneCallId";
5035 return "ErrorInvalidPhoneNumber";
5037 return "ErrorInvalidPropertyAppend";
5039 return "ErrorInvalidPropertyDelete";
5041 return "ErrorInvalidPropertyForExists";
5043 return "ErrorInvalidPropertyForOperation";
5045 return "ErrorInvalidPropertyRequest";
5047 return "ErrorInvalidPropertySet";
5049 return "ErrorInvalidPropertyUpdateSentMessage";
5051 return "ErrorInvalidProxySecurityContext";
5053 return "ErrorInvalidPullSubscriptionId";
5055 return "ErrorInvalidPushSubscriptionUrl";
5057 return "ErrorInvalidRecipients";
5059 return "ErrorInvalidRecipientSubfilter";
5061 return "ErrorInvalidRecipientSubfilterComparison";
5063 return "ErrorInvalidRecipientSubfilterOrder";
5065 return "ErrorInvalidRecipientSubfilterTextFilter";
5067 return "ErrorInvalidReferenceItem";
5069 return "ErrorInvalidRequest";
5071 return "ErrorInvalidRestriction";
5073 return "ErrorInvalidRetentionTagTypeMismatch";
5075 return "ErrorInvalidRetentionTagInvisible";
5077 return "ErrorInvalidRetentionTagInheritance";
5079 return "ErrorInvalidRetentionTagIdGuid";
5081 return "ErrorInvalidRoutingType";
5083 return "ErrorInvalidScheduledOofDuration";
5085 return "ErrorInvalidSchemaVersionForMailboxVersion";
5087 return "ErrorInvalidSecurityDescriptor";
5089 return "ErrorInvalidSendItemSaveSettings";
5091 return "ErrorInvalidSerializedAccessToken";
5093 return "ErrorInvalidSharingData";
5095 return "ErrorInvalidSharingMessage";
5097 return "ErrorInvalidSid";
5099 return "ErrorInvalidSIPUri";
5101 return "ErrorInvalidServerVersion";
5103 return "ErrorInvalidSmtpAddress";
5105 return "ErrorInvalidSubfilterType";
5107 return "ErrorInvalidSubfilterTypeNotAttendeeType";
5109 return "ErrorInvalidSubfilterTypeNotRecipientType";
5111 return "ErrorInvalidSubscription";
5113 return "ErrorInvalidSubscriptionRequest";
5115 return "ErrorInvalidSyncStateData";
5117 return "ErrorInvalidTimeInterval";
5119 return "ErrorInvalidUserInfo";
5121 return "ErrorInvalidUserOofSettings";
5123 return "ErrorInvalidUserPrincipalName";
5125 return "ErrorInvalidUserSid";
5127 return "ErrorInvalidUserSidMissingUPN";
5129 return "ErrorInvalidValueForProperty";
5131 return "ErrorInvalidWatermark";
5133 return "ErrorIPGatewayNotFound";
5135 return "ErrorIrresolvableConflict";
5137 return "ErrorItemCorrupt";
5139 return "ErrorItemNotFound";
5141 return "ErrorItemPropertyRequestFailed";
5143 return "ErrorItemSave";
5145 return "ErrorItemSavePropertyError";
5147 return "ErrorLegacyMailboxFreeBusyViewTypeNotMerged";
5149 return "ErrorLocalServerObjectNotFound";
5151 return "ErrorLogonAsNetworkServiceFailed";
5153 return "ErrorMailboxConfiguration";
5155 return "ErrorMailboxDataArrayEmpty";
5157 return "ErrorMailboxDataArrayTooBig";
5159 return "ErrorMailboxFailover";
5161 return "ErrorMailboxHoldNotFound";
5163 return "ErrorMailboxLogonFailed";
5165 return "ErrorMailboxMoveInProgress";
5167 return "ErrorMailboxStoreUnavailable";
5169 return "ErrorMailRecipientNotFound";
5171 return "ErrorMailTipsDisabled";
5173 return "ErrorManagedFolderAlreadyExists";
5175 return "ErrorManagedFolderNotFound";
5177 return "ErrorManagedFoldersRootFailure";
5179 return "ErrorMeetingSuggestionGenerationFailed";
5181 return "ErrorMessageDispositionRequired";
5183 return "ErrorMessageSizeExceeded";
5185 return "ErrorMessageTrackingNoSuchDomain";
5187 return "ErrorMessageTrackingPermanentError";
5189 return " ErrorMessageTrackingTransientError";
5191 return "ErrorMimeContentConversionFailed";
5193 return "ErrorMimeContentInvalid";
5195 return "ErrorMimeContentInvalidBase64String";
5197 return "ErrorMissingArgument";
5199 return "ErrorMissingEmailAddress";
5201 return "ErrorMissingEmailAddressForManagedFolder";
5203 return "ErrorMissingInformationEmailAddress";
5205 return "ErrorMissingInformationReferenceItemId";
5207 return "ErrorMissingItemForCreateItemAttachment";
5209 return "ErrorMissingManagedFolderId";
5211 return "ErrorMissingRecipients";
5213 return "ErrorMissingUserIdInformation";
5215 return "ErrorMoreThanOneAccessModeSpecified";
5217 return "ErrorMoveCopyFailed";
5219 return "ErrorMoveDistinguishedFolder";
5221 return "ErrorMultiLegacyMailboxAccess";
5223 return "ErrorNameResolutionMultipleResults";
5225 return "ErrorNameResolutionNoMailbox";
5227 return "ErrorNameResolutionNoResults";
5229 return "ErrorNoApplicableProxyCASServersAvailable";
5231 return "ErrorNoCalendar";
5234 return "ErrorNoDestinationCASDueToKerberosRequirements";
5236 return "ErrorNoDestinationCASDueToSSLRequirements";
5238 return "ErrorNoDestinationCASDueToVersionMismatch";
5240 return "ErrorNoFolderClassOverride";
5242 return "ErrorNoFreeBusyAccess";
5244 return "ErrorNonExistentMailbox";
5246 return "ErrorNonPrimarySmtpAddress";
5248 return "ErrorNoPropertyTagForCustomProperties";
5250 return "ErrorNoPublicFolderReplicaAvailable";
5252 return "ErrorNoPublicFolderServerAvailable";
5254 return "ErrorNoRespondingCASInDestinationSite";
5256 return "ErrorNotDelegate";
5258 return "ErrorNotEnoughMemory";
5260 return "ErrorNotSupportedSharingMessage";
5262 return "ErrorObjectTypeChanged";
5264 return "ErrorOccurrenceCrossingBoundary";
5266 return "ErrorOccurrenceTimeSpanTooBig";
5268 return "ErrorOperationNotAllowedWithPublicFolderRoot";
5270 return "ErrorOrganizationNotFederated";
5272 return "ErrorParentFolderIdRequired";
5274 return "ErrorParentFolderNotFound";
5276 return "ErrorPasswordChangeRequired";
5278 return "ErrorPasswordExpired";
5280 return "ErrorPhoneNumberNotDialable";
5282 return "ErrorPropertyUpdate";
5284 return "ErrorPromptPublishingOperationFailed";
5286 return "ErrorPropertyValidationFailure";
5288 return "ErrorProxiedSubscriptionCallFailure";
5290 return "ErrorProxyCallFailed";
5292 return "ErrorProxyGroupSidLimitExceeded";
5294 return "ErrorProxyRequestNotAllowed";
5296 return "ErrorProxyRequestProcessingFailed";
5298 return "ErrorProxyServiceDiscoveryFailed";
5300 return "ErrorProxyTokenExpired";
5302 return "ErrorPublicFolderMailboxDiscoveryFailed";
5304 return "ErrorPublicFolderOperationFailed";
5306 return "ErrorPublicFolderRequestProcessingFailed";
5308 return "ErrorPublicFolderServerNotFound";
5310 return "ErrorPublicFolderSyncException";
5312 return "ErrorQueryFilterTooLong";
5314 return "ErrorQuotaExceeded";
5316 return "ErrorReadEventsFailed";
5318 return "ErrorReadReceiptNotPending";
5320 return "ErrorRecurrenceEndDateTooBig";
5322 return "ErrorRecurrenceHasNoOccurrence";
5324 return "ErrorRemoveDelegatesFailed";
5326 return "ErrorRequestAborted";
5328 return "ErrorRequestStreamTooBig";
5330 return "ErrorRequiredPropertyMissing";
5332 return "ErrorResolveNamesInvalidFolderType";
5335 return "ErrorResolveNamesOnlyOneContactsFolderAllowed";
5337 return "ErrorResponseSchemaValidation";
5339 return "ErrorRestrictionTooLong";
5341 return "ErrorRestrictionTooComplex";
5343 return "ErrorResultSetTooBig";
5345 return "ErrorSavedItemFolderNotFound";
5347 return "ErrorSchemaValidation";
5349 return "ErrorSearchFolderNotInitialized";
5351 return "ErrorSendAsDenied";
5353 return "ErrorSendMeetingCancellationsRequired";
5356 return "ErrorSendMeetingInvitationsOrCancellationsRequired";
5358 return "ErrorSendMeetingInvitationsRequired";
5360 return "ErrorSentMeetingRequestUpdate";
5362 return "ErrorSentTaskRequestUpdate";
5364 return "ErrorServerBusy";
5366 return "ErrorServiceDiscoveryFailed";
5368 return "ErrorStaleObject";
5370 return "ErrorSubmissionQuotaExceeded";
5372 return "ErrorSubscriptionAccessDenied";
5374 return "ErrorSubscriptionDelegateAccessNotSupported";
5376 return "ErrorSubscriptionNotFound";
5378 return "ErrorSubscriptionUnsubscribed";
5380 return "ErrorSyncFolderNotFound";
5382 return "ErrorTeamMailboxNotFound";
5384 return "ErrorTeamMailboxNotLinkedToSharePoint";
5386 return "ErrorTeamMailboxUrlValidationFailed";
5388 return "ErrorTeamMailboxNotAuthorizedOwner";
5390 return "ErrorTeamMailboxActiveToPendingDelete";
5392 return "ErrorTeamMailboxFailedSendingNotifications";
5394 return "ErrorTeamMailboxErrorUnknown";
5396 return "ErrorTimeIntervalTooBig";
5398 return "ErrorTimeoutExpired";
5400 return "ErrorTimeZone";
5402 return "ErrorToFolderNotFound";
5404 return "ErrorTokenSerializationDenied";
5406 return "ErrorTooManyObjectsOpened";
5408 return "ErrorUnifiedMessagingDialPlanNotFound";
5410 return "ErrorUnifiedMessagingReportDataNotFound";
5412 return "ErrorUnifiedMessagingPromptNotFound";
5414 return "ErrorUnifiedMessagingRequestFailed";
5416 return "ErrorUnifiedMessagingServerNotFound";
5418 return "ErrorUnableToGetUserOofSettings";
5420 return "ErrorUnableToRemoveImContactFromGroup";
5422 return "ErrorUnsupportedCulture";
5424 return "ErrorUnsupportedMapiPropertyType";
5426 return "ErrorUnsupportedMimeConversion";
5428 return "ErrorUnsupportedPathForQuery";
5430 return "ErrorUnsupportedPathForSortGroup";
5432 return "ErrorUnsupportedPropertyDefinition";
5434 return "ErrorUnsupportedQueryFilter";
5436 return "ErrorUnsupportedRecurrence";
5438 return "ErrorUnsupportedSubFilter";
5440 return "ErrorUnsupportedTypeForConversion";
5442 return "ErrorUpdateDelegatesFailed";
5444 return "ErrorUpdatePropertyMismatch";
5446 return "ErrorUserNotUnifiedMessagingEnabled";
5448 return "ErrorUserNotAllowedByPolicy";
5450 return "ErrorUserWithoutFederatedProxyAddress";
5452 return "ErrorValueOutOfRange";
5454 return "ErrorVirusDetected";
5456 return "ErrorVirusMessageDeleted";
5458 return "ErrorVoiceMailNotImplemented";
5460 return "ErrorWebRequestInInvalidState";
5462 return "ErrorWin32InteropError";
5464 return "ErrorWorkingHoursSaveFailed";
5466 return "ErrorWorkingHoursXmlMalformed";
5468 return "ErrorWrongServerVersion";
5470 return "ErrorWrongServerVersionDelegate";
5472 return "ErrorMissingInformationSharingFolderId";
5474 return "ErrorDuplicateSOAPHeader";
5476 return "ErrorSharingSynchronizationFailed";
5478 return "ErrorSharingNoExternalEwsAvailable";
5480 return "ErrorFreeBusyDLLimitReached";
5482 return "ErrorInvalidGetSharingFolderRequest";
5484 return "ErrorNotAllowedExternalSharingByPolicy";
5486 return "ErrorPermissionNotAllowedByPolicy";
5488 return "ErrorMessageTrackingTransientError";
5490 return "ErrorApplyConversationActionFailed";
5492 return "ErrorInboxRulesValidationError";
5494 return "ErrorOutlookRuleBlobExists";
5496 return "ErrorRulesOverQuota";
5498 return "ErrorNewEventStreamConnectionOpened";
5500 return "ErrorMissedNotificationEvents";
5502 return "ErrorDuplicateLegacyDistinguishedName";
5504 return "ErrorInvalidClientAccessTokenRequest";
5506 return "ErrorNoSpeechDetected";
5508 return "ErrorUMServerUnavailable";
5510 return "ErrorRecipientNotFound";
5512 return "ErrorRecognizerNotInstalled";
5514 return "ErrorSpeechGrammarError";
5516 return "ErrorInvalidManagementRoleHeader";
5518 return "ErrorLocationServicesDisabled";
5520 return "ErrorLocationServicesRequestTimedOut";
5522 return "ErrorLocationServicesRequestFailed";
5524 return "ErrorLocationServicesInvalidRequest";
5526 return "ErrorWeatherServiceDisabled";
5529 return "ErrorMailboxScopeNotAllowedWithoutQueryString";
5531 return "ErrorArchiveMailboxSearchFailed";
5533 return "ErrorGetRemoteArchiveFolderFailed";
5535 return "ErrorFindRemoteArchiveFolderFailed";
5537 return "ErrorGetRemoteArchiveItemFailed";
5539 return "ErrorExportRemoteArchiveItemsFailed";
5541 return "ErrorInvalidPhotoSize";
5543 return "ErrorSearchQueryHasTooManyKeywords";
5545 return "ErrorSearchTooManyMailboxes";
5547 return "ErrorInvalidRetentionTagNone";
5549 return "ErrorDiscoverySearchesDisabled";
5551 return "ErrorCalendarSeekToConditionNotSupported";
5553 return "ErrorCalendarIsGroupMailboxForAccept";
5555 return "ErrorCalendarIsGroupMailboxForDecline";
5557 return "ErrorCalendarIsGroupMailboxForTentative";
5560 return "ErrorCalendarIsGroupMailboxForSuppressReadReceipt";
5562 return "ErrorOrganizationAccessBlocked";
5564 return "ErrorInvalidLicense";
5567 return "ErrorMessagePerFolderCountReceiveQuotaExceeded";
5569 throw exception(
"Unrecognized response code");
5609 dateline_standard_time,
5611 aleutian_standard_time,
5612 hawaiian_standard_time,
5613 marquesas_standard_time,
5614 alaskan_standard_time,
5616 pacific_standard_time_mexico,
5618 pacific_standard_time,
5619 us_mountain_standard_time,
5620 mountain_standard_time_mexico,
5621 mountain_standard_time,
5622 central_america_standard_time,
5623 central_standard_time,
5624 easter_island_standard_time,
5625 central_standard_time_mexico,
5626 canada_central_standard_time,
5627 sa_pacific_standard_time,
5628 eastern_standard_time_mexico,
5629 eastern_standard_time,
5630 haiti_standard_time,
5632 us_eastern_standard_time,
5633 turks_and_caicos_standard_time,
5634 paraguay_standard_time,
5635 atlantic_standard_time,
5636 venezuela_standard_time,
5637 central_brazilian_standard_time,
5638 sa_western_standard_time,
5639 pacific_sa_standard_time,
5640 newfoundland_standard_time,
5641 tocantins_standard_time,
5642 e_south_america_standard_time,
5643 sa_eastern_standard_time,
5644 argentina_standard_time,
5645 greenland_standard_time,
5646 montevideo_standard_time,
5647 magallanes_standard_time,
5648 saint_pierre_standard_time,
5649 bahia_standard_time,
5651 mid_minus_atlantic_standard_time,
5652 azores_standard_time,
5653 cape_verde_standard_time,
5655 morocco_standard_time,
5657 greenwich_standard_time,
5658 w_europe_standard_time,
5659 central_europe_standard_time,
5660 romance_standard_time,
5661 central_european_standard_time,
5662 w_central_africa_standard_time,
5663 jordan_standard_time,
5665 middle_east_standard_time,
5666 egypt_standard_time,
5667 e_europe_standard_time,
5668 syria_standard_time,
5669 west_bank_standard_time,
5670 south_africa_standard_time,
5672 israel_standard_time,
5673 kaliningrad_standard_time,
5674 sudan_standard_time,
5675 libya_standard_time,
5676 namibia_standard_time,
5677 arabic_standard_time,
5678 turkey_standard_time,
5680 belarus_standard_time,
5681 russian_standard_time,
5682 e_africa_standard_time,
5684 arabian_standard_time,
5685 astrakhan_standard_time,
5686 azerbaijan_standard_time,
5688 mauritius_standard_time,
5689 saratov_standard_time,
5690 georgian_standard_time,
5691 caucasus_standard_time,
5692 afghanistan_standard_time,
5693 west_asia_standard_time,
5694 ekaterinburg_standard_time,
5695 pakistan_standard_time,
5696 india_standard_time,
5697 sri_lanka_standard_time,
5698 nepal_standard_time,
5699 central_asia_standard_time,
5700 bangladesh_standard_time,
5702 myanmar_standard_time,
5703 se_asia_standard_time,
5704 altai_standard_time,
5705 w_mongolia_standard_time,
5706 north_asia_standard_time,
5707 n_central_asia_standard_time,
5708 tomsk_standard_time,
5709 china_standard_time,
5710 north_asia_east_standard_time,
5711 singapore_standard_time,
5712 w_australia_standard_time,
5713 taipei_standard_time,
5714 ulaanbaatar_standard_time,
5715 north_korea_standard_time,
5716 aus_central_w_standard_time,
5717 transbaikal_standard_time,
5718 tokyo_standard_time,
5719 korea_standard_time,
5720 yakutsk_standard_time,
5721 cen_australia_standard_time,
5722 aus_central_standard_time,
5723 e_australia_standard_time,
5724 aus_eastern_standard_time,
5725 west_pacific_standard_time,
5726 tasmania_standard_time,
5727 vladivostok_standard_time,
5728 lord_howe_standard_time,
5729 bougainville_standard_time,
5730 russia_time_zone_10,
5731 magadan_standard_time,
5732 norfolk_standard_time,
5733 sakhalin_standard_time,
5734 central_pacific_standard_time,
5735 russia_time_zone_11,
5736 new_zealand_standard_time,
5739 kamchatka_standard_time,
5740 chatham_islands_standard_time,
5742 tonga_standard_time,
5743 samoa_standard_time,
5744 line_islands_standard_time,
5749 inline std::string enum_to_str(
time_zone tz)
5753 case time_zone::dateline_standard_time:
5754 return "Dateline Standard Time";
5755 case time_zone::utc_minus_11:
5757 case time_zone::aleutian_standard_time:
5758 return "Aleutian Standard Time";
5759 case time_zone::hawaiian_standard_time:
5760 return "Hawaiian Standard Time";
5761 case time_zone::marquesas_standard_time:
5762 return "Marquesas Standard Time";
5763 case time_zone::alaskan_standard_time:
5764 return "Alaskan Standard Time";
5765 case time_zone::utc_minus_09:
5767 case time_zone::pacific_standard_time_mexico:
5768 return "Pacific Standard Time (Mexico)";
5769 case time_zone::utc_minus_08:
5771 case time_zone::pacific_standard_time:
5772 return "Pacific Standard Time";
5773 case time_zone::us_mountain_standard_time:
5774 return "US Mountain Standard Time";
5775 case time_zone::mountain_standard_time_mexico:
5776 return "Mountain Standard Time (Mexico)";
5777 case time_zone::mountain_standard_time:
5778 return "Mountain Standard Time";
5779 case time_zone::central_america_standard_time:
5780 return "Central America Standard Time";
5781 case time_zone::central_standard_time:
5782 return "Central Standard Time";
5783 case time_zone::easter_island_standard_time:
5784 return "Easter Island Standard Time";
5785 case time_zone::central_standard_time_mexico:
5786 return "Central Standard Time (Mexico)";
5787 case time_zone::canada_central_standard_time:
5788 return "Canada Central Standard Time";
5789 case time_zone::sa_pacific_standard_time:
5790 return "SA Pacific Standard Time";
5791 case time_zone::eastern_standard_time_mexico:
5792 return "Eastern Standard Time (Mexico)";
5793 case time_zone::eastern_standard_time:
5794 return "Eastern Standard Time";
5795 case time_zone::haiti_standard_time:
5796 return "Haiti Standard Time";
5797 case time_zone::cuba_standard_time:
5798 return "Cuba Standard Time";
5799 case time_zone::us_eastern_standard_time:
5800 return "US Eastern Standard Time";
5801 case time_zone::turks_and_caicos_standard_time:
5802 return "Turks And Caicos Standard Time";
5803 case time_zone::paraguay_standard_time:
5804 return "Paraguay Standard Time";
5805 case time_zone::atlantic_standard_time:
5806 return "Atlantic Standard Time";
5807 case time_zone::venezuela_standard_time:
5808 return "Venezuela Standard Time";
5809 case time_zone::central_brazilian_standard_time:
5810 return "Central Brazilian Standard Time";
5811 case time_zone::sa_western_standard_time:
5812 return "SA Western Standard Time";
5813 case time_zone::pacific_sa_standard_time:
5814 return "Pacific SA Standard Time";
5815 case time_zone::newfoundland_standard_time:
5816 return "Newfoundland Standard Time";
5817 case time_zone::tocantins_standard_time:
5818 return "Tocantins Standard Time";
5819 case time_zone::e_south_america_standard_time:
5820 return "E. South America Standard Time";
5821 case time_zone::sa_eastern_standard_time:
5822 return "SA Eastern Standard Time";
5823 case time_zone::argentina_standard_time:
5824 return "Argentina Standard Time";
5825 case time_zone::greenland_standard_time:
5826 return "Greenland Standard Time";
5827 case time_zone::montevideo_standard_time:
5828 return "Montevideo Standard Time";
5829 case time_zone::magallanes_standard_time:
5830 return "Magallanes Standard Time";
5831 case time_zone::saint_pierre_standard_time:
5832 return "Saint Pierre Standard Time";
5833 case time_zone::bahia_standard_time:
5834 return "Bahia Standard Time";
5835 case time_zone::utc_minus_02:
5837 case time_zone::mid_minus_atlantic_standard_time:
5838 return "Mid-Atlantic Standard Time";
5839 case time_zone::azores_standard_time:
5840 return "Azores Standard Time";
5841 case time_zone::cape_verde_standard_time:
5842 return "Cape Verde Standard Time";
5843 case time_zone::utc:
5845 case time_zone::morocco_standard_time:
5846 return "Morocco Standard Time";
5847 case time_zone::gmt_standard_time:
5848 return "GMT Standard Time";
5849 case time_zone::greenwich_standard_time:
5850 return "Greenwich Standard Time";
5851 case time_zone::w_europe_standard_time:
5852 return "W. Europe Standard Time";
5853 case time_zone::central_europe_standard_time:
5854 return "Central Europe Standard Time";
5855 case time_zone::romance_standard_time:
5856 return "Romance Standard Time";
5857 case time_zone::central_european_standard_time:
5858 return "Central European Standard Time";
5859 case time_zone::w_central_africa_standard_time:
5860 return "W. Central Africa Standard Time";
5861 case time_zone::jordan_standard_time:
5862 return "Jordan Standard Time";
5863 case time_zone::gtb_standard_time:
5864 return "GTB Standard Time";
5865 case time_zone::middle_east_standard_time:
5866 return "Middle East Standard Time";
5867 case time_zone::egypt_standard_time:
5868 return "Egypt Standard Time";
5869 case time_zone::e_europe_standard_time:
5870 return "E. Europe Standard Time";
5871 case time_zone::syria_standard_time:
5872 return "Syria Standard Time";
5873 case time_zone::west_bank_standard_time:
5874 return "West Bank Standard Time";
5875 case time_zone::south_africa_standard_time:
5876 return "South Africa Standard Time";
5877 case time_zone::fle_standard_time:
5878 return "FLE Standard Time";
5879 case time_zone::israel_standard_time:
5880 return "Israel Standard Time";
5881 case time_zone::kaliningrad_standard_time:
5882 return "Kaliningrad Standard Time";
5883 case time_zone::sudan_standard_time:
5884 return "Sudan Standard Time";
5885 case time_zone::libya_standard_time:
5886 return "Libya Standard Time";
5887 case time_zone::namibia_standard_time:
5888 return "Namibia Standard Time";
5889 case time_zone::arabic_standard_time:
5890 return "Arabic Standard Time";
5891 case time_zone::turkey_standard_time:
5892 return "Turkey Standard Time";
5893 case time_zone::arab_standard_time:
5894 return "Arab Standard Time";
5895 case time_zone::belarus_standard_time:
5896 return "Belarus Standard Time";
5897 case time_zone::russian_standard_time:
5898 return "Russian Standard Time";
5899 case time_zone::e_africa_standard_time:
5900 return "E. Africa Standard Time";
5901 case time_zone::iran_standard_time:
5902 return "Iran Standard Time";
5903 case time_zone::arabian_standard_time:
5904 return "Arabian Standard Time";
5905 case time_zone::astrakhan_standard_time:
5906 return "Astrakhan Standard Time";
5907 case time_zone::azerbaijan_standard_time:
5908 return "Azerbaijan Standard Time";
5909 case time_zone::russia_time_zone_3:
5910 return "Russia Time Zone 3";
5911 case time_zone::mauritius_standard_time:
5912 return "Mauritius Standard Time";
5913 case time_zone::saratov_standard_time:
5914 return "Saratov Standard Time";
5915 case time_zone::georgian_standard_time:
5916 return "Georgian Standard Time";
5917 case time_zone::caucasus_standard_time:
5918 return "Caucasus Standard Time";
5919 case time_zone::afghanistan_standard_time:
5920 return "Afghanistan Standard Time";
5921 case time_zone::west_asia_standard_time:
5922 return "West Asia Standard Time";
5923 case time_zone::ekaterinburg_standard_time:
5924 return "Ekaterinburg Standard Time";
5925 case time_zone::pakistan_standard_time:
5926 return "Pakistan Standard Time";
5927 case time_zone::india_standard_time:
5928 return "India Standard Time";
5929 case time_zone::sri_lanka_standard_time:
5930 return "Sri Lanka Standard Time";
5931 case time_zone::nepal_standard_time:
5932 return "Nepal Standard Time";
5933 case time_zone::central_asia_standard_time:
5934 return "Central Asia Standard Time";
5935 case time_zone::bangladesh_standard_time:
5936 return "Bangladesh Standard Time";
5937 case time_zone::omsk_standard_time:
5938 return "Omsk Standard Time";
5939 case time_zone::myanmar_standard_time:
5940 return "Myanmar Standard Time";
5941 case time_zone::se_asia_standard_time:
5942 return "SE Asia Standard Time";
5943 case time_zone::altai_standard_time:
5944 return "Altai Standard Time";
5945 case time_zone::w_mongolia_standard_time:
5946 return "W. Mongolia Standard Time";
5947 case time_zone::north_asia_standard_time:
5948 return "North Asia Standard Time";
5949 case time_zone::n_central_asia_standard_time:
5950 return "N. Central Asia Standard Time";
5951 case time_zone::tomsk_standard_time:
5952 return "Tomsk Standard Time";
5953 case time_zone::china_standard_time:
5954 return "China Standard Time";
5955 case time_zone::north_asia_east_standard_time:
5956 return "North Asia East Standard Time";
5957 case time_zone::singapore_standard_time:
5958 return "Singapore Standard Time";
5959 case time_zone::w_australia_standard_time:
5960 return "W. Australia Standard Time";
5961 case time_zone::taipei_standard_time:
5962 return "Taipei Standard Time";
5963 case time_zone::ulaanbaatar_standard_time:
5964 return "Ulaanbaatar Standard Time";
5965 case time_zone::north_korea_standard_time:
5966 return "North Korea Standard Time";
5967 case time_zone::aus_central_w_standard_time:
5968 return "Aus Central W. Standard Time";
5969 case time_zone::transbaikal_standard_time:
5970 return "Transbaikal Standard Time";
5971 case time_zone::tokyo_standard_time:
5972 return "Tokyo Standard Time";
5973 case time_zone::korea_standard_time:
5974 return "Korea Standard Time";
5975 case time_zone::yakutsk_standard_time:
5976 return "Yakutsk Standard Time";
5977 case time_zone::cen_australia_standard_time:
5978 return "Cen. Australia Standard Time";
5979 case time_zone::aus_central_standard_time:
5980 return "AUS Central Standard Time";
5981 case time_zone::e_australia_standard_time:
5982 return "E. Australia Standard Time";
5983 case time_zone::aus_eastern_standard_time:
5984 return "AUS Eastern Standard Time";
5985 case time_zone::west_pacific_standard_time:
5986 return "West Pacific Standard Time";
5987 case time_zone::tasmania_standard_time:
5988 return "Tasmania Standard Time";
5989 case time_zone::vladivostok_standard_time:
5990 return "Vladivostok Standard Time";
5991 case time_zone::lord_howe_standard_time:
5992 return "Lord Howe Standard Time";
5993 case time_zone::bougainville_standard_time:
5994 return "Bougainville Standard Time";
5995 case time_zone::russia_time_zone_10:
5996 return "Russia Time Zone 10";
5997 case time_zone::magadan_standard_time:
5998 return "Magadan Standard Time";
5999 case time_zone::norfolk_standard_time:
6000 return "Norfolk Standard Time";
6001 case time_zone::sakhalin_standard_time:
6002 return "Sakhalin Standard Time";
6003 case time_zone::central_pacific_standard_time:
6004 return "Central Pacific Standard Time";
6005 case time_zone::russia_time_zone_11:
6006 return "Russia Time Zone 11";
6007 case time_zone::new_zealand_standard_time:
6008 return "New Zealand Standard Time";
6009 case time_zone::utc_plus_12:
6011 case time_zone::fiji_standard_time:
6012 return "Fiji Standard Time";
6013 case time_zone::kamchatka_standard_time:
6014 return "Kamchatka Standard Time";
6015 case time_zone::chatham_islands_standard_time:
6016 return "Chatham Islands Standard Time";
6017 case time_zone::utc_plus_13:
6019 case time_zone::tonga_standard_time:
6020 return "Tonga Standard Time";
6021 case time_zone::samoa_standard_time:
6022 return "Samoa Standard Time";
6023 case time_zone::line_islands_standard_time:
6024 return "Line Islands Standard Time";
6030 inline time_zone str_to_time_zone(
const std::string& str)
6032 if (str ==
"Dateline Standard Time")
6034 return time_zone::dateline_standard_time;
6036 if (str ==
"UTC-11")
6038 return time_zone::utc_minus_11;
6040 if (str ==
"Aleutian Standard Time")
6042 return time_zone::aleutian_standard_time;
6044 if (str ==
"Hawaiian Standard Time")
6046 return time_zone::hawaiian_standard_time;
6048 if (str ==
"Marquesas Standard Time")
6050 return time_zone::marquesas_standard_time;
6052 if (str ==
"Alaskan Standard Time")
6054 return time_zone::alaskan_standard_time;
6056 if (str ==
"UTC-09")
6058 return time_zone::utc_minus_09;
6060 if (str ==
"Pacific Standard Time (Mexico)")
6062 return time_zone::pacific_standard_time_mexico;
6064 if (str ==
"UTC-08")
6066 return time_zone::utc_minus_08;
6068 if (str ==
"Pacific Standard Time")
6070 return time_zone::pacific_standard_time;
6072 if (str ==
"US Mountain Standard Time")
6074 return time_zone::us_mountain_standard_time;
6076 if (str ==
"Mountain Standard Time (Mexico)")
6078 return time_zone::mountain_standard_time_mexico;
6080 if (str ==
"Mountain Standard Time")
6082 return time_zone::mountain_standard_time;
6084 if (str ==
"Central America Standard Time")
6086 return time_zone::central_america_standard_time;
6088 if (str ==
"Central Standard Time")
6090 return time_zone::central_standard_time;
6092 if (str ==
"Easter Island Standard Time")
6094 return time_zone::easter_island_standard_time;
6096 if (str ==
"Central Standard Time (Mexico)")
6098 return time_zone::central_standard_time_mexico;
6100 if (str ==
"Canada Central Standard Time")
6102 return time_zone::canada_central_standard_time;
6104 if (str ==
"SA Pacific Standard Time")
6106 return time_zone::sa_pacific_standard_time;
6108 if (str ==
"Eastern Standard Time (Mexico)")
6110 return time_zone::eastern_standard_time_mexico;
6112 if (str ==
"Eastern Standard Time")
6114 return time_zone::eastern_standard_time;
6116 if (str ==
"Haiti Standard Time")
6118 return time_zone::haiti_standard_time;
6120 if (str ==
"Cuba Standard Time")
6122 return time_zone::cuba_standard_time;
6124 if (str ==
"US Eastern Standard Time")
6126 return time_zone::us_eastern_standard_time;
6128 if (str ==
"Turks And Caicos Standard Time")
6130 return time_zone::turks_and_caicos_standard_time;
6132 if (str ==
"Paraguay Standard Time")
6134 return time_zone::paraguay_standard_time;
6136 if (str ==
"Atlantic Standard Time")
6138 return time_zone::atlantic_standard_time;
6140 if (str ==
"Venezuela Standard Time")
6142 return time_zone::venezuela_standard_time;
6144 if (str ==
"Central Brazilian Standard Time")
6146 return time_zone::central_brazilian_standard_time;
6148 if (str ==
"SA Western Standard Time")
6150 return time_zone::sa_western_standard_time;
6152 if (str ==
"Pacific SA Standard Time")
6154 return time_zone::pacific_sa_standard_time;
6156 if (str ==
"Newfoundland Standard Time")
6158 return time_zone::newfoundland_standard_time;
6160 if (str ==
"Tocantins Standard Time")
6162 return time_zone::tocantins_standard_time;
6164 if (str ==
"E. South America Standard Time")
6166 return time_zone::e_south_america_standard_time;
6168 if (str ==
"SA Eastern Standard Time")
6170 return time_zone::sa_eastern_standard_time;
6172 if (str ==
"Argentina Standard Time")
6174 return time_zone::argentina_standard_time;
6176 if (str ==
"Greenland Standard Time")
6178 return time_zone::greenland_standard_time;
6180 if (str ==
"Montevideo Standard Time")
6182 return time_zone::montevideo_standard_time;
6184 if (str ==
"Magallanes Standard Time")
6186 return time_zone::magallanes_standard_time;
6188 if (str ==
"Saint Pierre Standard Time")
6190 return time_zone::saint_pierre_standard_time;
6192 if (str ==
"Bahia Standard Time")
6194 return time_zone::bahia_standard_time;
6196 if (str ==
"UTC-02")
6198 return time_zone::utc_minus_02;
6200 if (str ==
"Mid-Atlantic Standard Time")
6202 return time_zone::mid_minus_atlantic_standard_time;
6204 if (str ==
"Azores Standard Time")
6206 return time_zone::azores_standard_time;
6208 if (str ==
"Cape Verde Standard Time")
6210 return time_zone::cape_verde_standard_time;
6214 return time_zone::utc;
6216 if (str ==
"Morocco Standard Time")
6218 return time_zone::morocco_standard_time;
6220 if (str ==
"GMT Standard Time")
6222 return time_zone::gmt_standard_time;
6224 if (str ==
"Greenwich Standard Time")
6226 return time_zone::greenwich_standard_time;
6228 if (str ==
"W. Europe Standard Time")
6230 return time_zone::w_europe_standard_time;
6232 if (str ==
"Central Europe Standard Time")
6234 return time_zone::central_europe_standard_time;
6236 if (str ==
"Romance Standard Time")
6238 return time_zone::romance_standard_time;
6240 if (str ==
"Central European Standard Time")
6242 return time_zone::central_european_standard_time;
6244 if (str ==
"W. Central Africa Standard Time")
6246 return time_zone::w_central_africa_standard_time;
6248 if (str ==
"Jordan Standard Time")
6250 return time_zone::jordan_standard_time;
6252 if (str ==
"GTB Standard Time")
6254 return time_zone::gtb_standard_time;
6256 if (str ==
"Middle East Standard Time")
6258 return time_zone::middle_east_standard_time;
6260 if (str ==
"Egypt Standard Time")
6262 return time_zone::egypt_standard_time;
6264 if (str ==
"E. Europe Standard Time")
6266 return time_zone::e_europe_standard_time;
6268 if (str ==
"Syria Standard Time")
6270 return time_zone::syria_standard_time;
6272 if (str ==
"West Bank Standard Time")
6274 return time_zone::west_bank_standard_time;
6276 if (str ==
"South Africa Standard Time")
6278 return time_zone::south_africa_standard_time;
6280 if (str ==
"FLE Standard Time")
6282 return time_zone::fle_standard_time;
6284 if (str ==
"Israel Standard Time")
6286 return time_zone::israel_standard_time;
6288 if (str ==
"Kaliningrad Standard Time")
6290 return time_zone::kaliningrad_standard_time;
6292 if (str ==
"Sudan Standard Time")
6294 return time_zone::sudan_standard_time;
6296 if (str ==
"Libya Standard Time")
6298 return time_zone::libya_standard_time;
6300 if (str ==
"Namibia Standard Time")
6302 return time_zone::namibia_standard_time;
6304 if (str ==
"Arabic Standard Time")
6306 return time_zone::arabic_standard_time;
6308 if (str ==
"Turkey Standard Time")
6310 return time_zone::turkey_standard_time;
6312 if (str ==
"Arab Standard Time")
6314 return time_zone::arab_standard_time;
6316 if (str ==
"Belarus Standard Time")
6318 return time_zone::belarus_standard_time;
6320 if (str ==
"Russian Standard Time")
6322 return time_zone::russian_standard_time;
6324 if (str ==
"E. Africa Standard Time")
6326 return time_zone::e_africa_standard_time;
6328 if (str ==
"Iran Standard Time")
6330 return time_zone::iran_standard_time;
6332 if (str ==
"Arabian Standard Time")
6334 return time_zone::arabian_standard_time;
6336 if (str ==
"Astrakhan Standard Time")
6338 return time_zone::astrakhan_standard_time;
6340 if (str ==
"Azerbaijan Standard Time")
6342 return time_zone::azerbaijan_standard_time;
6344 if (str ==
"Russia Time Zone 3")
6346 return time_zone::russia_time_zone_3;
6348 if (str ==
"Mauritius Standard Time")
6350 return time_zone::mauritius_standard_time;
6352 if (str ==
"Saratov Standard Time")
6354 return time_zone::saratov_standard_time;
6356 if (str ==
"Georgian Standard Time")
6358 return time_zone::georgian_standard_time;
6360 if (str ==
"Caucasus Standard Time")
6362 return time_zone::caucasus_standard_time;
6364 if (str ==
"Afghanistan Standard Time")
6366 return time_zone::afghanistan_standard_time;
6368 if (str ==
"West Asia Standard Time")
6370 return time_zone::west_asia_standard_time;
6372 if (str ==
"Ekaterinburg Standard Time")
6374 return time_zone::ekaterinburg_standard_time;
6376 if (str ==
"Pakistan Standard Time")
6378 return time_zone::pakistan_standard_time;
6380 if (str ==
"India Standard Time")
6382 return time_zone::india_standard_time;
6384 if (str ==
"Sri Lanka Standard Time")
6386 return time_zone::sri_lanka_standard_time;
6388 if (str ==
"Nepal Standard Time")
6390 return time_zone::nepal_standard_time;
6392 if (str ==
"Central Asia Standard Time")
6394 return time_zone::central_asia_standard_time;
6396 if (str ==
"Bangladesh Standard Time")
6398 return time_zone::bangladesh_standard_time;
6400 if (str ==
"Omsk Standard Time")
6402 return time_zone::omsk_standard_time;
6404 if (str ==
"Myanmar Standard Time")
6406 return time_zone::myanmar_standard_time;
6408 if (str ==
"SE Asia Standard Time")
6410 return time_zone::se_asia_standard_time;
6412 if (str ==
"Altai Standard Time")
6414 return time_zone::altai_standard_time;
6416 if (str ==
"W. Mongolia Standard Time")
6418 return time_zone::w_mongolia_standard_time;
6420 if (str ==
"North Asia Standard Time")
6422 return time_zone::north_asia_standard_time;
6424 if (str ==
"N. Central Asia Standard Time")
6426 return time_zone::n_central_asia_standard_time;
6428 if (str ==
"Tomsk Standard Time")
6430 return time_zone::tomsk_standard_time;
6432 if (str ==
"China Standard Time")
6434 return time_zone::china_standard_time;
6436 if (str ==
"North Asia East Standard Time")
6438 return time_zone::north_asia_east_standard_time;
6440 if (str ==
"Singapore Standard Time")
6442 return time_zone::singapore_standard_time;
6444 if (str ==
"W. Australia Standard Time")
6446 return time_zone::w_australia_standard_time;
6448 if (str ==
"Taipei Standard Time")
6450 return time_zone::taipei_standard_time;
6452 if (str ==
"Ulaanbaatar Standard Time")
6454 return time_zone::ulaanbaatar_standard_time;
6456 if (str ==
"North Korea Standard Time")
6458 return time_zone::north_korea_standard_time;
6460 if (str ==
"Aus Central W. Standard Time")
6462 return time_zone::aus_central_w_standard_time;
6464 if (str ==
"Transbaikal Standard Time")
6466 return time_zone::transbaikal_standard_time;
6468 if (str ==
"Tokyo Standard Time")
6470 return time_zone::tokyo_standard_time;
6472 if (str ==
"Korea Standard Time")
6474 return time_zone::korea_standard_time;
6476 if (str ==
"Yakutsk Standard Time")
6478 return time_zone::yakutsk_standard_time;
6480 if (str ==
"Cen. Australia Standard Time")
6482 return time_zone::cen_australia_standard_time;
6484 if (str ==
"AUS Central Standard Time")
6486 return time_zone::aus_central_standard_time;
6488 if (str ==
"E. Australia Standard Time")
6490 return time_zone::e_australia_standard_time;
6492 if (str ==
"AUS Eastern Standard Time")
6494 return time_zone::aus_eastern_standard_time;
6496 if (str ==
"West Pacific Standard Time")
6498 return time_zone::west_pacific_standard_time;
6500 if (str ==
"Tasmania Standard Time")
6502 return time_zone::tasmania_standard_time;
6504 if (str ==
"Vladivostok Standard Time")
6506 return time_zone::vladivostok_standard_time;
6508 if (str ==
"Lord Howe Standard Time")
6510 return time_zone::lord_howe_standard_time;
6512 if (str ==
"Bougainville Standard Time")
6514 return time_zone::bougainville_standard_time;
6516 if (str ==
"Russia Time Zone 10")
6518 return time_zone::russia_time_zone_10;
6520 if (str ==
"Magadan Standard Time")
6522 return time_zone::magadan_standard_time;
6524 if (str ==
"Norfolk Standard Time")
6526 return time_zone::norfolk_standard_time;
6528 if (str ==
"Sakhalin Standard Time")
6530 return time_zone::sakhalin_standard_time;
6532 if (str ==
"Central Pacific Standard Time")
6534 return time_zone::central_pacific_standard_time;
6536 if (str ==
"Russia Time Zone 11")
6538 return time_zone::russia_time_zone_11;
6540 if (str ==
"New Zealand Standard Time")
6542 return time_zone::new_zealand_standard_time;
6544 if (str ==
"UTC+12")
6546 return time_zone::utc_plus_12;
6548 if (str ==
"Fiji Standard Time")
6550 return time_zone::fiji_standard_time;
6552 if (str ==
"Kamchatka Standard Time")
6554 return time_zone::kamchatka_standard_time;
6556 if (str ==
"Chatham Islands Standard Time")
6558 return time_zone::chatham_islands_standard_time;
6560 if (str ==
"UTC+13")
6562 return time_zone::utc_plus_13;
6564 if (str ==
"Tonga Standard Time")
6566 return time_zone::tonga_standard_time;
6568 if (str ==
"Samoa Standard Time")
6570 return time_zone::samoa_standard_time;
6572 if (str ==
"Line Islands Standard Time")
6574 return time_zone::line_islands_standard_time;
6577 throw exception(
"Unrecognized <TimeZone>");
6618 return "Exchange2007";
6620 return "Exchange2007_SP1";
6622 return "Exchange2010";
6624 return "Exchange2010_SP1";
6626 return "Exchange2010_SP2";
6628 return "Exchange2013";
6630 return "Exchange2013_SP1";
6636 inline server_version str_to_server_version(
const std::string& str)
6638 if (str ==
"Exchange2007")
6642 else if (str ==
"Exchange2007_SP1")
6646 else if (str ==
"Exchange2010")
6650 else if (str ==
"Exchange2010_SP1")
6654 else if (str ==
"Exchange2010_SP2")
6658 else if (str ==
"Exchange2013")
6662 else if (str ==
"Exchange2013_SP1")
6668 throw exception(
"Unrecognized <RequestServerVersion>");
6692 inline std::string enum_to_str(
base_shape shape)
6701 return "AllProperties";
6728 return "HardDelete";
6730 return "MoveToDeletedItems";
6754 return "AllOccurrences";
6756 return "SpecifiedOccurrenceOnly";
6795 return "SendToNone";
6797 return "SendOnlyToAll";
6799 return "SendOnlyToChanged";
6802 return "SendToAllAndSaveCopy";
6805 return "SendToChangedAndSaveCopy";
6837 return "SendToNone";
6839 return "SendOnlyToAll";
6841 return "SendToAllAndSaveCopy";
6876 return "NeverOverwrite";
6878 return "AutoResolve";
6880 return "AlwaysOverwrite";
6915 return "SendAndSaveCopy";
6967 return "WorkingElsewhere";
7027 return "NoResponseReceived";
7033 inline response_type str_to_response_type(
const std::string& str)
7035 if (str ==
"Unknown")
7039 else if (str ==
"Organizer")
7043 else if (str ==
"Tentative")
7047 else if (str ==
"Accept")
7051 else if (str ==
"Decline")
7055 else if (str ==
"NoResponseReceived")
7212 std::string internal_ews_url;
7213 std::string external_ews_url;
7218 std::string autodiscover_url;
7247 return "Confidential";
7253 inline sensitivity str_to_sensitivity(
const std::string& str)
7255 if (str ==
"Normal")
7259 else if (str ==
"Personal")
7263 else if (str ==
"Private")
7267 else if (str ==
"Confidential")
7310 inline importance str_to_importance(
const std::string& str)
7316 else if (str ==
"High")
7320 else if (str ==
"Normal")
7330 struct response_result
7337 : cls(cls_), code(code_), message()
7343 : cls(cls_), code(code_), message(std::move(msg))
7372 return "ActiveDirectory";
7374 return "ActiveDirectoryContacts";
7378 return "ContactsActiveDirectory";
7384 inline search_scope str_to_search_scope(
const std::string& str)
7386 if (str ==
"ActiveDirectory")
7390 else if (str ==
"ActiveDirectoryContacts")
7394 else if (str ==
"Contacts")
7398 else if (str ==
"ContactsActiveDirectory")
7409 #ifdef EWS_HAS_VARIANT 7410 enum class event_type
7435 free_busy_changed_event
7440 inline std::string enum_to_str(event_type e)
7444 case event_type::copied_event:
7445 return "CopiedEvent";
7446 case event_type::created_event:
7447 return "CreatedEvent";
7448 case event_type::deleted_event:
7449 return "DeletedEvent";
7450 case event_type::modified_event:
7451 return "ModifiedEvent";
7452 case event_type::moved_event:
7453 return "MovedEvent";
7454 case event_type::new_mail_event:
7455 return "NewMailEvent";
7456 case event_type::status_event:
7457 return "StatusEvent";
7458 case event_type::free_busy_changed_event:
7459 return "FreeBusyChangedEvent";
7465 inline event_type str_to_event_type(
const std::string& str)
7467 if (str ==
"CopiedEvent")
7469 return event_type::copied_event;
7471 else if (str ==
"CreatedEvent")
7473 return event_type::created_event;
7475 else if (str ==
"DeletedEvent")
7477 return event_type::deleted_event;
7479 else if (str ==
"ModifiedEvent")
7481 return event_type::modified_event;
7483 else if (str ==
"MovedEvent")
7485 return event_type::moved_event;
7487 else if (str ==
"NewMailEvent")
7489 return event_type::new_mail_event;
7491 else if (str ==
"StatusEvent")
7493 return event_type::status_event;
7495 else if (str ==
"FreeBusyChangedEvent")
7497 return event_type::free_busy_changed_event;
7513 :
exception(internal::enum_to_str(code)), code_(code)
7521 ? internal::enum_to_str(code)
7522 : sanitize(message_text) +
" (" +
7523 internal::enum_to_str(code) +
")"),
7528 #ifndef EWS_DOXYGEN_SHOULD_SKIP_THIS 7531 ? internal::enum_to_str(res.code)
7532 : sanitize(res.message) +
" (" +
7533 internal::enum_to_str(res.code) +
")"),
7542 std::string sanitize(
const std::string& message_text)
7545 if (!message_text.empty() || message_text.back() ==
'.')
7547 std::string tmp(message_text);
7552 return message_text;
7560 inline std::string http_status_code_to_str(
int status_code)
7562 switch (status_code)
7567 return "Switching Protocols";
7575 return "Non-Authoritative Information";
7577 return "No Content";
7579 return "Reset Content";
7581 return "Partial Content";
7583 return "Multiple Choices";
7585 return "Moved Permanently";
7591 return "Not Modified";
7595 return "Temporary Redirect";
7597 return "Bad Request";
7599 return "Unauthorized";
7601 return "Payment Required";
7607 return "Method Not Allowed";
7609 return "Not Acceptable";
7611 return "Proxy Authentication Required";
7613 return "Request Timeout";
7619 return "Length Required";
7621 return "Precondition Failed";
7623 return "Request Entity Too Large";
7625 return "Request-URI Too Long";
7627 return "Unsupported Media Type";
7629 return "Requested Range Not Satisfiable";
7631 return "Expectation Failed";
7633 return "Internal Server Error";
7635 return "Not Implemented";
7637 return "Bad Gateway";
7639 return "Service Unavailable";
7641 return "Gateway Timeout";
7643 return "HTTP Version Not Supported";
7654 :
exception(
"HTTP status code: " + std::to_string(status_code) +
" (" +
7655 internal::http_status_code_to_str(status_code) +
")"),
7660 long code()
const EWS_NOEXCEPT {
return code_; }
7687 unsigned long line_position, std::string violation)
7688 :
soap_fault(
"The request failed schema validation"),
7689 violation_(std::move(violation)), line_pos_(line_position),
7690 line_no_(line_number)
7701 const std::string&
violation() const EWS_NOEXCEPT {
return violation_; }
7704 std::string violation_;
7705 unsigned long line_pos_;
7706 unsigned long line_no_;
7714 const std::string& error_details =
"")
7715 :
exception(what), error_details_(error_details)
7718 explicit curl_error(
const char* what,
const std::string& error_details =
"")
7719 :
exception(what), error_details_(error_details)
7726 return error_details_;
7730 std::string error_details_;
7740 inline curl_error make_curl_error(
const std::string& msg, CURLcode rescode,
7741 const std::string& error_details =
"")
7743 auto reason = std::string(curl_easy_strerror(rescode));
7748 return curl_error(msg +
": \'" + reason +
"\'", error_details);
7753 class curl_ptr final
7756 curl_ptr() : handle_(curl_easy_init())
7760 throw curl_error(
"Could not start libcurl session");
7763 curl_easy_setopt(handle_, CURLOPT_ERRORBUFFER, error_details_);
7766 curl_ptr(
const curl_ptr& other)
7767 : handle_(curl_easy_duphandle(other.handle_))
7771 throw curl_error(
"Could not dup curl handle");
7774 curl_easy_setopt(handle_, CURLOPT_ERRORBUFFER, error_details_);
7777 ~curl_ptr() { curl_easy_cleanup(handle_); }
7779 #ifdef EWS_HAS_DEFAULT_AND_DELETE 7780 curl_ptr& operator=(
const curl_ptr&) =
delete;
7783 curl_ptr& operator=(
const curl_ptr&);
7788 curl_ptr(curl_ptr&& other) : handle_(std::move(other.handle_))
7790 other.handle_ =
nullptr;
7791 curl_easy_setopt(handle_, CURLOPT_ERRORBUFFER, error_details_);
7794 curl_ptr& operator=(curl_ptr&& rhs)
7798 handle_ = std::move(rhs.handle_);
7799 rhs.handle_ =
nullptr;
7800 curl_easy_setopt(handle_, CURLOPT_ERRORBUFFER, error_details_);
7805 CURL*
get()
const EWS_NOEXCEPT {
return handle_; }
7807 const char* get_error_details()
const EWS_NOEXCEPT
7809 return error_details_;
7814 char error_details_[CURL_ERROR_SIZE];
7817 #if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 7818 defined(EWS_HAS_CXX17_STATIC_ASSERT) 7819 static_assert(std::is_default_constructible<curl_ptr>::value);
7820 static_assert(std::is_copy_constructible<curl_ptr>::value);
7821 static_assert(!std::is_copy_assignable<curl_ptr>::value);
7822 static_assert(std::is_move_constructible<curl_ptr>::value);
7823 static_assert(std::is_move_assignable<curl_ptr>::value);
7827 class curl_string_list final
7830 curl_string_list() EWS_NOEXCEPT : slist_(
nullptr) {}
7832 ~curl_string_list() { curl_slist_free_all(slist_); }
7834 #ifdef EWS_HAS_DEFAULT_AND_DELETE 7835 curl_string_list(
const curl_string_list&) =
delete;
7836 curl_string_list& operator=(
const curl_string_list&) =
delete;
7839 curl_string_list(
const curl_string_list&);
7840 curl_string_list& operator=(
const curl_string_list&);
7845 curl_string_list(curl_string_list&& other)
7846 : slist_(std::move(other.slist_))
7848 other.slist_ =
nullptr;
7851 curl_string_list& operator=(curl_string_list&& rhs)
7855 slist_ = std::move(rhs.slist_);
7856 rhs.slist_ =
nullptr;
7861 void append(
const char* str) EWS_NOEXCEPT
7863 slist_ = curl_slist_append(slist_, str);
7866 curl_slist*
get()
const EWS_NOEXCEPT {
return slist_; }
7872 #if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 7873 defined(EWS_HAS_CXX17_STATIC_ASSERT) 7874 static_assert(std::is_default_constructible<curl_string_list>::value);
7875 static_assert(!std::is_copy_constructible<curl_string_list>::value);
7876 static_assert(!std::is_copy_assignable<curl_string_list>::value);
7877 static_assert(std::is_move_constructible<curl_string_list>::value);
7878 static_assert(std::is_move_assignable<curl_string_list>::value);
7885 template <
typename Ch =
char>
struct uri
7893 static const Ch* errors()
7895 static const Ch* val =
"http://schemas.microsoft.com/" 7896 "exchange/services/2006/errors";
7903 static const Ch* types()
7905 static const Ch*
const val =
"http://schemas.microsoft.com/" 7906 "exchange/services/2006/types";
7913 static const Ch* messages()
7915 static const Ch*
const val =
"http://schemas.microsoft.com/" 7916 "exchange/services/2006/" 7922 autodiscover_size = 79U
7924 static const Ch* autodiscover()
7926 static const Ch*
const val =
"http://schemas.microsoft.com/" 7927 "exchange/autodiscover/" 7928 "outlook/responseschema/2006a";
7939 static const Ch* envelope()
7941 static const Ch*
const val =
7942 "http://schemas.xmlsoap.org/soap/envelope/";
7952 class http_response final
7955 http_response(
long code, std::vector<char>&& data)
7956 : data_(std::move(data)), code_(code)
7958 check(!data_.empty(),
"Given data should not be empty");
7961 #ifdef EWS_HAS_DEFAULT_AND_DELETE 7962 ~http_response() =
default;
7964 http_response(
const http_response&) =
delete;
7965 http_response& operator=(
const http_response&) =
delete;
7970 http_response(
const http_response&);
7971 http_response& operator=(
const http_response&);
7976 http_response(http_response&& other)
7977 : data_(std::move(other.data_)), code_(std::move(other.code_))
7982 http_response& operator=(http_response&& rhs)
7986 data_ = std::move(rhs.data_);
7987 code_ = std::move(rhs.code_);
7994 std::vector<char>& content() EWS_NOEXCEPT {
return data_; }
7998 const std::vector<char>& content()
const EWS_NOEXCEPT {
return data_; }
8001 long code()
const EWS_NOEXCEPT {
return code_; }
8009 bool is_soap_fault()
const EWS_NOEXCEPT {
return code() == 500U; }
8012 bool ok()
const EWS_NOEXCEPT {
return code() == 200U; }
8015 std::vector<char> data_;
8026 inline std::unique_ptr<rapidxml::xml_document<char>>
8027 parse_response(http_response&& response)
8029 if (response.content().empty())
8034 #ifdef EWS_HAS_MAKE_UNIQUE 8035 auto doc = std::make_unique<rapidxml::xml_document<char>>();
8037 auto doc = std::unique_ptr<rapidxml::xml_document<char>>(
8038 new rapidxml::xml_document<char>());
8042 static const int flags = 0;
8043 doc->parse<flags>(&response.content()[0]);
8045 catch (rapidxml::parse_error& exc)
8049 xml_parse_error::error_message_from(exc, response.content());
8053 #ifdef EWS_ENABLE_VERBOSE 8054 std::cerr <<
"Response code: " << response.code() <<
", Content:\n\'" 8055 << *doc <<
"\'" << std::endl;
8063 inline rapidxml::xml_node<>& create_node(rapidxml::xml_node<>& parent,
8064 const std::string& name)
8066 auto doc = parent.document();
8067 check(doc,
"Parent node needs to be part of a document");
8068 auto ptr_to_qname = doc->allocate_string(name.c_str());
8069 auto new_node = doc->allocate_node(rapidxml::node_element);
8070 new_node->qname(ptr_to_qname, name.length(), ptr_to_qname + 2);
8071 new_node->namespace_uri(internal::uri<>::microsoft::types(),
8072 internal::uri<>::microsoft::types_size);
8073 parent.append_node(new_node);
8077 inline rapidxml::xml_node<>& create_node(rapidxml::xml_node<>& parent,
8078 const std::string& name,
8079 const std::string& value)
8081 auto doc = parent.document();
8082 check(doc,
"Parent node needs to be part of a document");
8083 auto str = doc->allocate_string(value.c_str());
8084 auto& new_node = create_node(parent, name);
8085 new_node.value(str);
8093 template <
typename Function>
8094 inline bool traverse_elements(
const rapidxml::xml_node<>& node,
8095 Function func) EWS_NOEXCEPT
8097 for (
auto child = node.first_node(); child !=
nullptr;
8098 child = child->next_sibling())
8100 if (traverse_elements(*child, func))
8105 if (child->type() == rapidxml::node_element)
8119 inline rapidxml::xml_node<>*
8120 get_element_by_qname(
const rapidxml::xml_node<>& node,
8121 const char* local_name,
const char* namespace_uri)
8123 check(local_name,
"Expected local_name, got nullptr");
8124 check(namespace_uri,
"Expected namespace_uri, got nullptr");
8126 rapidxml::xml_node<>* element =
nullptr;
8127 const auto local_name_len = strlen(local_name);
8128 const auto namespace_uri_len = strlen(namespace_uri);
8129 traverse_elements(node, [&](rapidxml::xml_node<>& elem) ->
bool {
8130 using rapidxml::internal::compare;
8132 if (compare(elem.namespace_uri(), elem.namespace_uri_size(),
8133 namespace_uri, namespace_uri_len) &&
8134 compare(elem.local_name(), elem.local_name_size(), local_name,
8137 element = std::addressof(elem);
8148 #ifdef EWS_HAS_DEFAULT_AND_DELETE 8149 virtual ~credentials() =
default;
8150 credentials& operator=(
const credentials&) =
default;
8152 virtual ~credentials() {}
8154 virtual void certify(http_request*)
const = 0;
8158 class oauth2_basic :
public credentials
8161 oauth2_basic(std::string tenant, std::string client_id,
8163 : tenant_(std::move(tenant)), client_id_(std::move(client_id)),
8164 scope_(std::move(scope))
8168 #ifdef EWS_HAS_DEFAULT_AND_DELETE 8169 virtual ~oauth2_basic() =
default;
8170 oauth2_basic& operator=(
const oauth2_basic&) =
default;
8172 virtual ~oauth2_basic() {}
8175 void certify(internal::http_request*)
const override;
8177 bool expired()
const 8179 return (std::chrono::steady_clock::now() > expiration);
8185 virtual void authenticate(internal::http_request* request)
const;
8187 virtual void append_url(CURL* c, std::string& data)
const = 0;
8190 std::string tenant_;
8191 std::string client_id_;
8193 mutable std::string access_token;
8194 mutable std::chrono::steady_clock::time_point expiration;
8214 : username_(std::move(username)), password_(std::move(password))
8220 void certify(internal::http_request*)
const override;
8222 std::string username_;
8223 std::string password_;
8240 : username_(std::move(username)), password_(std::move(password)),
8241 domain_(std::move(domain))
8247 void certify(internal::http_request*)
const override;
8249 std::string username_;
8250 std::string password_;
8251 std::string domain_;
8261 std::string client_secret, std::string scope,
8262 std::string resource)
8263 : oauth2_basic(std::move(tenant), std::move(client_id),
8265 client_secret_(std::move(client_secret)),
8266 resource_(std::move(resource))
8271 void append_url(CURL* c, std::string& data)
const override;
8273 const std::string client_secret_;
8274 const std::string resource_;
8281 :
public internal::oauth2_basic
8285 std::string tenant, std::string client_id, std::string client_secret,
8286 std::string scope, std::string username, std::string password)
8287 : oauth2_basic(std::move(tenant), std::move(client_id),
8289 username_(std::move(username)), password_(std::move(password)),
8290 client_secret_(std::move(client_secret))
8295 void append_url(CURL* c, std::string& data)
const override;
8297 const std::string username_;
8298 const std::string password_;
8299 const std::string client_secret_;
8304 class http_request final
8313 explicit http_request(
const std::string& url)
8315 set_option(CURLOPT_URL, url.c_str());
8319 explicit http_request(
const curl_ptr& handle) : handle_(handle)
8325 const curl_ptr& get_handle()
const {
return handle_; }
8328 void set_method(method)
8331 set_option(CURLOPT_POST, 1);
8335 void set_content_type(
const std::string& content_type)
8337 const std::string str =
"Content-Type: " + content_type;
8338 headers_.append(str.c_str());
8342 void set_content_length(
size_t content_length)
8344 const std::string str =
8345 "Content-Length: " + std::to_string(content_length);
8346 headers_.append(str.c_str());
8349 void set_authorization(
const std::string& authorization)
8351 const std::string str =
"Authorization: " + authorization;
8352 headers_.append(str.c_str());
8356 void set_credentials(
const credentials& creds) { creds.certify(
this); }
8358 void set_timeout(std::chrono::seconds timeout)
8360 curl_easy_setopt(handle_.get(), CURLOPT_TIMEOUT, timeout.count());
8363 #ifdef EWS_HAS_VARIADIC_TEMPLATES 8369 template <
typename... Args>
8370 void set_option(CURLoption option, Args... args)
8372 auto retcode = curl_easy_setopt(handle_.get(), option,
8373 std::forward<Args>(args)...);
8379 case CURLE_FAILED_INIT:
8381 throw make_curl_error(
"curl_easy_setopt: unsupported option",
8387 throw make_curl_error(
"curl_easy_setopt: failed setting option",
8393 template <
typename T1>
void set_option(CURLoption option, T1 arg1)
8395 auto retcode = curl_easy_setopt(handle_.get(), option, arg1);
8401 case CURLE_FAILED_INIT:
8403 throw make_curl_error(
"curl_easy_setopt: unsupported option",
8409 throw make_curl_error(
"curl_easy_setopt: failed setting option",
8415 template <
typename T1,
typename T2>
8416 void set_option(CURLoption option, T1 arg1, T2 arg2)
8418 auto retcode = curl_easy_setopt(handle_.get(), option, arg1, arg2);
8424 case CURLE_FAILED_INIT:
8426 throw make_curl_error(
"curl_easy_setopt: unsupported option",
8432 throw make_curl_error(
"curl_easy_setopt: failed setting option",
8445 http_response send(
const std::string& request)
8447 auto callback = [](
char* ptr,
size_t size,
size_t nmemb,
8448 void* userdata) ->
size_t {
8449 std::vector<char>* buf =
8450 reinterpret_cast<std::vector<char>*
>(userdata);
8451 const auto realsize = size * nmemb;
8454 buf->reserve(realsize + 1);
8456 catch (std::bad_alloc&)
8461 std::copy(ptr, ptr + realsize, std::back_inserter(*buf));
8470 set_option(CURLOPT_NOSIGNAL, 1L);
8472 #ifdef EWS_ENABLE_VERBOSE 8474 set_option(CURLOPT_VERBOSE, 1L);
8479 set_option(CURLOPT_POSTFIELDS, request.c_str());
8480 set_option(CURLOPT_POSTFIELDSIZE, request.length());
8485 set_option(CURLOPT_HTTPHEADER, headers_.get());
8487 std::vector<char> response_data;
8488 set_option(CURLOPT_WRITEFUNCTION,
8489 static_cast<size_t (*)(
char*,
size_t,
size_t,
void*)
>(
8491 set_option(CURLOPT_WRITEDATA, std::addressof(response_data));
8493 #ifdef EWS_DISABLE_TLS_CERT_VERIFICATION 8497 "warning: TLS verification of the server's authenticity is disabled") 8500 set_option(CURLOPT_SSL_VERIFYPEER, 0L);
8501 set_option(CURLOPT_SSL_VERIFYHOST, 0L);
8503 # if LIBCURL_VERSION_NUM >= 0x073400 8504 set_option(CURLOPT_PROXY_SSL_VERIFYPEER, 0L);
8505 set_option(CURLOPT_PROXY_SSL_VERIFYHOST, 0L);
8510 auto retcode = curl_easy_perform(handle_.get());
8513 throw make_curl_error(
"curl_easy_perform", retcode,
8514 handle_.get_error_details());
8517 curl_easy_getinfo(handle_.get(), CURLINFO_RESPONSE_CODE,
8519 response_data.emplace_back(
'\0');
8520 return http_response(std::move(response_code),
8521 std::move(response_data));
8526 curl_string_list headers_;
8529 #if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 8530 defined(EWS_HAS_CXX17_STATIC_ASSERT) 8531 static_assert(!std::is_default_constructible<http_request>::value);
8532 static_assert(!std::is_copy_constructible<http_request>::value);
8533 static_assert(!std::is_copy_assignable<http_request>::value);
8534 static_assert(std::is_move_constructible<http_request>::value);
8535 static_assert(std::is_move_assignable<http_request>::value);
8538 #ifdef EWS_HAS_DEFAULT_TEMPLATE_ARGS_FOR_FUNCTIONS 8539 template <
typename RequestHandler = http_request>
8541 template <
typename RequestHandler>
8543 inline http_response
8544 make_raw_soap_request(RequestHandler& handler,
const std::string& soap_body,
8545 const std::vector<std::string>& soap_headers)
8547 std::stringstream request_stream;
8549 <<
"<?xml version=\"1.0\" encoding=\"utf-8\"?>" 8551 "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " 8552 "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" " 8553 "xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" " 8554 "xmlns:m=\"http://schemas.microsoft.com/exchange/services/" 8556 "xmlns:t=\"http://schemas.microsoft.com/exchange/services/" 8559 if (!soap_headers.empty())
8561 request_stream <<
"<soap:Header>";
8562 for (
const auto& header : soap_headers)
8564 request_stream << header;
8566 request_stream <<
"</soap:Header>";
8569 request_stream <<
"<soap:Body>";
8570 request_stream << soap_body;
8571 request_stream <<
"</soap:Body>";
8572 request_stream <<
"</soap:Envelope>";
8574 #ifdef EWS_ENABLE_VERBOSE 8575 std::cerr << request_stream.str() << std::endl;
8577 return handler.send(request_stream.str());
8590 #ifdef EWS_HAS_DEFAULT_TEMPLATE_ARGS_FOR_FUNCTIONS 8591 template <
typename RequestHandler = http_request>
8593 template <
typename RequestHandler>
8595 inline http_response
8596 make_raw_soap_request(
const std::string& url,
const std::string& username,
8597 const std::string& password,
8598 const std::string& domain,
8599 const std::string& soap_body,
8600 const std::vector<std::string>& soap_headers)
8602 RequestHandler handler(url);
8603 handler.set_method(RequestHandler::method::POST);
8604 handler.set_content_type(
"text/xml; charset=utf-8");
8606 handler.set_credentials(creds);
8607 return make_raw_soap_request(handler, soap_body, soap_headers);
8625 class xml_subtree final
8636 xml_subtree() : rawdata_(), doc_(
new rapidxml::xml_document<char>) {}
8638 explicit xml_subtree(
const rapidxml::xml_node<char>& origin,
8639 size_t size_hint = 0U)
8640 : rawdata_(), doc_(
new rapidxml::xml_document<char>)
8642 reparse(origin, size_hint);
8649 xml_subtree& operator=(
const xml_subtree& rhs)
8657 reparse(*rhs.doc_, rhs.rawdata_.size());
8662 xml_subtree(
const xml_subtree& other)
8663 : rawdata_(), doc_(
new rapidxml::xml_document<char>)
8665 reparse(*other.doc_, other.rawdata_.size());
8670 rapidxml::xml_node<>*
root() EWS_NOEXCEPT {
return doc_->first_node(); }
8674 const rapidxml::xml_node<>*
root()
const EWS_NOEXCEPT
8676 return doc_->first_node();
8681 rapidxml::xml_node<char>*
8682 get_node(
const char* node_name)
const EWS_NOEXCEPT
8684 return get_element_by_qname(*doc_, node_name,
8685 uri<>::microsoft::types());
8688 rapidxml::xml_node<char>*
8689 get_node(
const std::string& node_name)
const EWS_NOEXCEPT
8691 return get_node(node_name.c_str());
8694 rapidxml::xml_document<char>* document()
const EWS_NOEXCEPT
8699 std::string get_value_as_string(
const char* node_name)
const 8701 const auto node = get_node(node_name);
8702 return node ? std::string(node->value(), node->value_size()) :
"";
8708 rapidxml::xml_node<char>& set_or_update(
const std::string& node_name,
8709 const std::string& node_value)
8711 using rapidxml::internal::compare;
8713 auto oldnode = get_element_by_qname(*doc_, node_name.c_str(),
8714 uri<>::microsoft::types());
8715 if (oldnode && compare(node_value.c_str(), node_value.length(),
8716 oldnode->value(), oldnode->value_size()))
8722 const auto node_qname =
"t:" + node_name;
8723 const auto ptr_to_qname = doc_->allocate_string(node_qname.c_str());
8724 const auto ptr_to_value = doc_->allocate_string(node_value.c_str());
8726 auto newnode = doc_->allocate_node(rapidxml::node_element);
8727 newnode->qname(ptr_to_qname, node_qname.length(), ptr_to_qname + 2);
8728 newnode->value(ptr_to_value);
8729 newnode->namespace_uri(uri<>::microsoft::types(),
8730 uri<>::microsoft::types_size);
8733 auto parent = oldnode->parent();
8734 parent->insert_node(oldnode, newnode);
8735 parent->remove_node(oldnode);
8739 doc_->append_node(newnode);
8747 rapidxml::xml_node<char>&
8748 set_or_update(
const std::string& node_name,
8749 const std::vector<attribute>& attributes)
8751 using rapidxml::internal::compare;
8753 auto oldnode = get_element_by_qname(*doc_, node_name.c_str(),
8754 uri<>::microsoft::types());
8755 const auto node_qname =
"t:" + node_name;
8756 const auto ptr_to_qname = doc_->allocate_string(node_qname.c_str());
8758 auto newnode = doc_->allocate_node(rapidxml::node_element);
8759 newnode->qname(ptr_to_qname, node_qname.length(), ptr_to_qname + 2);
8760 newnode->namespace_uri(uri<>::microsoft::types(),
8761 uri<>::microsoft::types_size);
8763 for (
auto& attrib : attributes)
8765 const auto name = doc_->allocate_string(attrib.name.c_str());
8766 const auto value = doc_->allocate_string(attrib.value.c_str());
8767 auto attr = doc_->allocate_attribute(name, value);
8768 newnode->append_attribute(attr);
8773 auto parent = oldnode->parent();
8774 parent->insert_node(oldnode, newnode);
8775 parent->remove_node(oldnode);
8779 doc_->append_node(newnode);
8783 std::string to_string()
const 8786 rapidxml::print(std::back_inserter(str), *doc_,
8787 rapidxml::print_no_indenting);
8791 void append_to(rapidxml::xml_node<>& dest)
const 8793 auto target_document = dest.document();
8794 auto source = doc_->first_node();
8797 auto new_child = deep_copy(target_document, source);
8798 dest.append_node(new_child);
8803 std::vector<char> rawdata_;
8804 std::unique_ptr<rapidxml::xml_document<char>> doc_;
8808 struct custom_namespace_processor
8809 :
public rapidxml::internal::xml_namespace_processor<char>
8811 struct scope :
public rapidxml::internal::xml_namespace_processor<
8814 explicit scope(xml_namespace_processor& processor)
8815 : rapidxml::internal::xml_namespace_processor<char>::scope(
8818 static auto nsattr = make_namespace_attribute();
8819 add_namespace_prefix(&nsattr);
8822 static rapidxml::xml_attribute<char> make_namespace_attribute()
8824 static const char*
const name =
"t";
8825 static const char*
const value = uri<>::microsoft::types();
8826 rapidxml::xml_attribute<char> attr;
8828 attr.value(value, uri<>::microsoft::types_size);
8834 void reparse(
const rapidxml::xml_node<char>& source,
size_t size_hint)
8836 rawdata_.reserve(size_hint);
8837 rapidxml::print(std::back_inserter(rawdata_), source,
8838 rapidxml::print_no_indenting);
8839 rawdata_.emplace_back(
'\0');
8846 doc_->parse_ns<0, custom_namespace_processor>(&rawdata_[0]);
8849 static rapidxml::xml_node<>*
8850 deep_copy(rapidxml::xml_document<>* target_doc,
8851 const rapidxml::xml_node<>* source)
8853 check(target_doc,
"Expected target_doc, got nullptr");
8854 check(source,
"Expected source, got nullptr");
8856 auto newnode = target_doc->allocate_node(source->type());
8859 auto name = target_doc->allocate_string(source->name());
8860 newnode->qname(name, source->name_size(), source->local_name());
8862 auto value = target_doc->allocate_string(source->value());
8863 newnode->value(value, source->value_size());
8866 for (
auto child = source->first_node(); child;
8867 child = child->next_sibling())
8869 newnode->append_node(deep_copy(target_doc, child));
8872 for (
auto attr = source->first_attribute(); attr;
8873 attr = attr->next_attribute())
8875 newnode->append_attribute(target_doc->allocate_attribute(
8876 attr->name(), attr->value(), attr->name_size(),
8877 attr->value_size()));
8884 #if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 8885 defined(EWS_HAS_CXX17_STATIC_ASSERT) 8886 static_assert(std::is_default_constructible<xml_subtree>::value);
8887 static_assert(std::is_copy_constructible<xml_subtree>::value);
8888 static_assert(std::is_copy_assignable<xml_subtree>::value);
8889 static_assert(std::is_move_constructible<xml_subtree>::value);
8890 static_assert(std::is_move_assignable<xml_subtree>::value);
8893 #ifdef EWS_HAS_DEFAULT_TEMPLATE_ARGS_FOR_FUNCTIONS 8894 template <
typename RequestHandler = http_request>
8896 template <
typename RequestHandler>
8901 unsigned int redirections,
8904 using rapidxml::internal::compare;
8908 if (redirections > 2)
8910 throw exception(
"Maximum of two redirections reached");
8914 if (user_smtp_address.empty())
8916 throw exception(
"Empty SMTP address given");
8919 std::string autodiscover_url;
8920 if (hints.autodiscover_url.empty())
8923 const auto at_sign_idx = user_smtp_address.find_first_of(
"@");
8924 if (at_sign_idx == std::string::npos)
8926 throw exception(
"No valid SMTP address given");
8929 const auto username = user_smtp_address.substr(0, at_sign_idx);
8930 const auto domain = user_smtp_address.substr(
8931 at_sign_idx + 1, user_smtp_address.size());
8937 "https://" + domain +
"/autodiscover/autodiscover.xml";
8941 autodiscover_url = hints.autodiscover_url;
8944 std::stringstream sstr;
8945 sstr <<
"<?xml version=\"1.0\" encoding=\"utf-8\" ?>" 8947 <<
"xmlns=\"http://schemas.microsoft.com/exchange/" 8948 "autodiscover/outlook/requestschema/2006\">" 8950 <<
"<EMailAddress>" << user_smtp_address <<
"</EMailAddress>" 8951 <<
"<AcceptableResponseSchema>" 8952 << internal::uri<>::microsoft::autodiscover()
8953 <<
"</AcceptableResponseSchema>" 8955 <<
"</Autodiscover>";
8956 const auto request_string = sstr.str();
8958 RequestHandler handler(autodiscover_url);
8959 handler.set_method(RequestHandler::method::POST);
8960 handler.set_credentials(credentials);
8961 handler.set_content_type(
"text/xml; charset=utf-8");
8962 handler.set_content_length(request_string.size());
8964 #ifdef EWS_ENABLE_VERBOSE 8965 std::cerr << request_string << std::endl;
8968 auto response = handler.send(request_string);
8974 const auto doc = parse_response(std::move(response));
8976 const auto account_node = get_element_by_qname(
8977 *doc,
"Account", internal::uri<>::microsoft::autodiscover());
8981 const auto error_node =
8982 get_element_by_qname(*doc,
"Error",
8983 "http://schemas.microsoft.com/exchange/" 8984 "autodiscover/responseschema/2006");
8987 std::string error_code;
8990 for (
auto node = error_node->first_node(); node;
8991 node = node->next_sibling())
8993 if (compare(node->local_name(), node->local_name_size(),
8994 "ErrorCode", strlen(
"ErrorCode")))
8997 std::string(node->value(), node->value_size());
8999 else if (compare(node->local_name(),
9000 node->local_name_size(),
"Message",
9004 std::string(node->value(), node->value_size());
9007 if (!error_code.empty() && !message.empty())
9010 " (error code: " + error_code +
")");
9015 throw exception(
"Unable to parse response");
9021 std::string protocol;
9023 for (
int i = 0; i < 2; i++)
9025 for (
auto protocol_node = account_node->first_node(); protocol_node;
9026 protocol_node = protocol_node->next_sibling())
9036 if (compare(protocol_node->local_name(),
9037 protocol_node->local_name_size(),
"Protocol",
9038 strlen(
"Protocol")))
9040 for (
auto type_node = protocol_node->first_node();
9041 type_node; type_node = type_node->next_sibling())
9043 if (compare(type_node->local_name(),
9044 type_node->local_name_size(),
"Type",
9046 compare(type_node->value(), type_node->value_size(),
9047 protocol.c_str(), strlen(protocol.c_str())))
9049 for (
auto asurl_node = protocol_node->first_node();
9051 asurl_node = asurl_node->next_sibling())
9053 if (compare(asurl_node->local_name(),
9054 asurl_node->local_name_size(),
9055 "ASUrl", strlen(
"ASUrl")))
9059 result.internal_ews_url = std::string(
9060 asurl_node->value(),
9061 asurl_node->value_size());
9066 result.external_ews_url = std::string(
9067 asurl_node->value(),
9068 asurl_node->value_size());
9082 for (
auto redirect_node = account_node->first_node(); redirect_node;
9083 redirect_node = redirect_node->next_sibling())
9085 if (compare(redirect_node->local_name(),
9086 redirect_node->local_name_size(),
"RedirectAddr",
9087 strlen(
"RedirectAddr")))
9091 const auto redirect_address = std::string(
9092 redirect_node->value(), redirect_node->value_size());
9093 return get_exchange_web_services_url<RequestHandler>(
9094 redirect_address, credentials, redirections, hints);
9098 throw exception(
"Autodiscovery failed unexpectedly");
9101 inline std::string escape(
const char* str)
9104 rapidxml::internal::copy_and_expand_chars(str, str + strlen(str),
'\0',
9105 std::back_inserter(res));
9109 inline std::string escape(
const std::string& str)
9111 return escape(str.c_str());
9121 inline void set_up() EWS_NOEXCEPT { curl_global_init(CURL_GLOBAL_DEFAULT); }
9129 inline void tear_down() EWS_NOEXCEPT { curl_global_cleanup(); }
9136 #ifdef EWS_HAS_DEFAULT_TEMPLATE_ARGS_FOR_FUNCTIONS 9137 template <
typename RequestHandler =
internal::http_request>
9139 template <
typename RequestHandler>
9146 return internal::get_exchange_web_services_url<RequestHandler>(
9147 user_smtp_address, credentials, 0U, hints);
9156 #ifdef EWS_HAS_DEFAULT_TEMPLATE_ARGS_FOR_FUNCTIONS 9157 template <
typename RequestHandler =
internal::http_request>
9159 template <
typename RequestHandler>
9166 return internal::get_exchange_web_services_url<RequestHandler>(
9167 user_smtp_address, credentials, 0U, hints);
9189 #ifdef EWS_HAS_DEFAULT_AND_DELETE 9197 explicit item_id(std::string
id) : id_(std::move(id)), change_key_() {}
9202 : id_(std::move(id)), change_key_(std::move(change_key))
9207 const std::string&
id() const EWS_NOEXCEPT {
return id_; }
9210 const std::string&
change_key() const EWS_NOEXCEPT {
return change_key_; }
9213 bool valid() const EWS_NOEXCEPT {
return !id_.empty(); }
9218 return "<t:ItemId Id=\"" + id() +
"\" ChangeKey=\"" + change_key() +
9225 auto id_attr = elem.first_attribute(
"Id");
9226 check(id_attr,
"Missing attribute Id in <ItemId>");
9227 auto id = std::string(id_attr->value(), id_attr->value_size());
9228 auto ckey_attr = elem.first_attribute(
"ChangeKey");
9229 check(ckey_attr,
"Missing attribute ChangeKey in <ItemId>");
9230 auto ckey = std::string(ckey_attr->value(), ckey_attr->value_size());
9231 return item_id(std::move(
id), std::move(ckey));
9238 std::string change_key_;
9241 #if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 9242 defined(EWS_HAS_CXX17_STATIC_ASSERT) 9243 static_assert(std::is_default_constructible<item_id>::value);
9244 static_assert(std::is_copy_constructible<item_id>::value);
9245 static_assert(std::is_copy_assignable<item_id>::value);
9246 static_assert(std::is_move_constructible<item_id>::value);
9247 static_assert(std::is_move_assignable<item_id>::value);
9255 #ifdef EWS_HAS_DEFAULT_AND_DELETE 9264 : id_(std::move(id)), change_key_(), instance_index_(1)
9271 : id_(item_id.id()), change_key_(item_id.change_key()),
9279 : id_(item_id.id()), change_key_(item_id.change_key()),
9280 instance_index_(instance_index)
9288 : id_(std::move(id)), change_key_(std::move(change_key)),
9289 instance_index_(instance_index)
9294 const std::string&
id() const EWS_NOEXCEPT {
return id_; }
9297 const std::string&
change_key() const EWS_NOEXCEPT {
return change_key_; }
9303 bool valid() const EWS_NOEXCEPT {
return !id_.empty(); }
9308 std::stringstream sstr;
9309 sstr <<
"<t:OccurrenceItemId RecurringMasterId=\"" << id();
9310 sstr <<
"\" ChangeKey=\"" << change_key() <<
"\" InstanceIndex=\"";
9311 sstr << instance_index() <<
"\"/>";
9319 auto id_attr = elem.first_attribute(
"RecurringMasterId");
9321 "Missing attribute RecurringMasterId in <OccurrenceItemId>");
9322 auto id = std::string(id_attr->value(), id_attr->value_size());
9324 auto ckey_attr = elem.first_attribute(
"ChangeKey");
9325 check(ckey_attr,
"Missing attribute ChangeKey in <OccurrenceItemId>");
9326 auto ckey = std::string(ckey_attr->value(), ckey_attr->value_size());
9328 auto index_attr = elem.first_attribute(
"InstanceIndex");
9330 "Missing attribute InstanceIndex in <OccurrenceItemId>");
9331 auto index = std::stoi(
9332 std::string(index_attr->value(), index_attr->value_size()));
9341 std::string change_key_;
9342 int instance_index_;
9345 #if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 9346 defined(EWS_HAS_CXX17_STATIC_ASSERT) 9347 static_assert(std::is_default_constructible<occurrence_item_id>::value);
9348 static_assert(std::is_copy_constructible<occurrence_item_id>::value);
9349 static_assert(std::is_copy_assignable<occurrence_item_id>::value);
9350 static_assert(std::is_move_constructible<occurrence_item_id>::value);
9351 static_assert(std::is_move_assignable<occurrence_item_id>::value);
9361 #ifdef EWS_HAS_DEFAULT_AND_DELETE 9367 #ifndef EWS_DOXYGEN_SHOULD_SKIP_THIS 9368 explicit attachment_id(std::string
id) : id_(std::move(
id)) {}
9371 : id_(std::move(
id)), root_item_id_(std::move(root_item_id))
9378 const std::string&
id() const EWS_NOEXCEPT {
return id_; }
9391 bool valid() const EWS_NOEXCEPT {
return !id_.empty(); }
9393 std::string to_xml()
const 9395 std::stringstream sstr;
9396 sstr <<
"<t:AttachmentId Id=\"" << id() <<
"\"";
9397 if (root_item_id().valid())
9399 sstr <<
" RootItemId=\"" << root_item_id().
id()
9400 <<
"\" RootItemChangeKey=\"" << root_item_id().
change_key()
9410 auto id_attr = elem.first_attribute(
"Id");
9411 check(id_attr,
"Missing attribute Id in <AttachmentId>");
9412 auto id = std::string(id_attr->value(), id_attr->value_size());
9413 auto root_item_id = std::string();
9414 auto root_item_ckey = std::string();
9416 auto root_item_id_attr = elem.first_attribute(
"RootItemId");
9417 if (root_item_id_attr)
9419 root_item_id = std::string(root_item_id_attr->value(),
9420 root_item_id_attr->value_size());
9421 auto root_item_ckey_attr =
9422 elem.first_attribute(
"RootItemChangeKey");
9423 check(root_item_ckey_attr,
9424 "Expected attribute 'RootItemChangeKey'");
9425 root_item_ckey = std::string(root_item_ckey_attr->value(),
9426 root_item_ckey_attr->value_size());
9429 return root_item_id.empty()
9432 item_id(std::move(root_item_id),
9433 std::move(root_item_ckey)));
9441 #if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 9442 defined(EWS_HAS_CXX17_STATIC_ASSERT) 9443 static_assert(std::is_default_constructible<attachment_id>::value);
9444 static_assert(std::is_copy_constructible<attachment_id>::value);
9445 static_assert(std::is_copy_assignable<attachment_id>::value);
9446 static_assert(std::is_move_constructible<attachment_id>::value);
9447 static_assert(std::is_move_assignable<attachment_id>::value);
9458 #ifdef EWS_HAS_DEFAULT_AND_DELETE 9469 : id_(std::move(
id)), value_(), name_(), routing_type_(),
9474 explicit mailbox(std::string value, std::string name = std::string(),
9475 std::string routing_type = std::string(),
9476 std::string mailbox_type = std::string())
9477 : id_(), value_(std::move(value)), name_(std::move(name)),
9478 routing_type_(std::move(routing_type)),
9479 mailbox_type_(std::move(mailbox_type))
9484 bool none() const EWS_NOEXCEPT {
return value_.empty() && !id_.valid(); }
9487 const item_id& id()
const EWS_NOEXCEPT {
return id_; }
9490 const std::string&
value() const EWS_NOEXCEPT {
return value_; }
9495 const std::string&
name() const EWS_NOEXCEPT {
return name_; }
9502 return routing_type_;
9510 return mailbox_type_;
9522 std::string
to_xml(
const char* xmlns =
"t")
const 9524 std::stringstream sstr;
9525 sstr <<
"<" << xmlns <<
":Mailbox>";
9532 sstr <<
"<t:EmailAddress>" << value() <<
"</t:EmailAddress>";
9534 if (!name().empty())
9536 sstr <<
"<t:Name>" << name() <<
"</t:Name>";
9539 if (!routing_type().empty())
9541 sstr <<
"<t:RoutingType>" << routing_type()
9542 <<
"</t:RoutingType>";
9545 if (!mailbox_type().empty())
9547 sstr <<
"<t:MailboxType>" << mailbox_type()
9548 <<
"</t:MailboxType>";
9551 sstr <<
"</" << xmlns <<
":Mailbox>";
9561 auto doc = parent.document();
9563 check(doc,
"Parent node needs to be somewhere in a document");
9565 using namespace internal;
9566 auto& mailbox_node = create_node(parent,
"t:Mailbox");
9570 check(!value_.empty(),
9571 "Neither item_id nor value set in mailbox instance");
9573 create_node(mailbox_node,
"t:EmailAddress", value_);
9577 create_node(mailbox_node,
"t:Name", name_);
9580 if (!routing_type_.empty())
9582 create_node(mailbox_node,
"t:RoutingType", routing_type_);
9585 if (!mailbox_type_.empty())
9587 create_node(mailbox_node,
"t:MailboxType", mailbox_type_);
9592 auto item_id_node = &create_node(mailbox_node,
"t:ItemId");
9594 auto ptr_to_key = doc->allocate_string(
"Id");
9595 auto ptr_to_value = doc->allocate_string(id_.id().c_str());
9596 item_id_node->append_attribute(
9597 doc->allocate_attribute(ptr_to_key, ptr_to_value));
9599 ptr_to_key = doc->allocate_string(
"ChangeKey");
9600 ptr_to_value = doc->allocate_string(id_.change_key().c_str());
9601 item_id_node->append_attribute(
9602 doc->allocate_attribute(ptr_to_key, ptr_to_value));
9604 return mailbox_node;
9610 using rapidxml::internal::compare;
9621 std::string address;
9622 std::string routing_type;
9623 std::string mailbox_type;
9626 for (
auto node = elem.first_node(); node; node = node->next_sibling())
9628 if (compare(node->local_name(), node->local_name_size(),
"Name",
9631 name = std::string(node->value(), node->value_size());
9633 else if (compare(node->local_name(), node->local_name_size(),
9634 "EmailAddress", strlen(
"EmailAddress")))
9636 address = std::string(node->value(), node->value_size());
9638 else if (compare(node->local_name(), node->local_name_size(),
9639 "RoutingType", strlen(
"RoutingType")))
9641 routing_type = std::string(node->value(), node->value_size());
9643 else if (compare(node->local_name(), node->local_name_size(),
9644 "MailboxType", strlen(
"MailboxType")))
9646 mailbox_type = std::string(node->value(), node->value_size());
9648 else if (compare(node->local_name(), node->local_name_size(),
9649 "ItemId", strlen(
"ItemId")))
9655 throw exception(
"Unexpected child element in <Mailbox>");
9661 return mailbox(std::move(address), std::move(name),
9662 std::move(routing_type), std::move(mailbox_type));
9665 return mailbox(std::move(
id));
9672 std::string routing_type_;
9673 std::string mailbox_type_;
9676 #if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 9677 defined(EWS_HAS_CXX17_STATIC_ASSERT) 9678 static_assert(std::is_default_constructible<mailbox>::value);
9679 static_assert(std::is_copy_constructible<mailbox>::value);
9680 static_assert(std::is_copy_assignable<mailbox>::value);
9681 static_assert(std::is_move_constructible<mailbox>::value);
9682 static_assert(std::is_move_assignable<mailbox>::value);
9688 #ifdef EWS_HAS_DEFAULT_AND_DELETE 9693 explicit directory_id(
const std::string& str) : id_(str) {}
9694 const std::string& get_id()
const EWS_NOEXCEPT {
return id_; }
9700 #if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 9701 defined(EWS_HAS_CXX17_STATIC_ASSERT) 9702 static_assert(std::is_default_constructible<directory_id>::value);
9703 static_assert(std::is_copy_constructible<directory_id>::value);
9704 static_assert(std::is_copy_assignable<directory_id>::value);
9705 static_assert(std::is_move_constructible<directory_id>::value);
9706 static_assert(std::is_move_assignable<directory_id>::value);
9713 std::shared_ptr<ews::contact>
contact;
9716 #if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 9717 defined(EWS_HAS_CXX17_STATIC_ASSERT) 9718 static_assert(std::is_default_constructible<resolution>::value);
9719 static_assert(std::is_copy_constructible<resolution>::value);
9720 static_assert(std::is_copy_assignable<resolution>::value);
9721 static_assert(std::is_move_constructible<resolution>::value);
9722 static_assert(std::is_move_assignable<resolution>::value);
9729 : includes_last_item_in_range(
true), indexed_paging_offset(0),
9730 numerator_offset(0), absolute_denominator(0), total_items_in_view(0)
9735 bool empty() const EWS_NOEXCEPT {
return resolutions.empty(); }
9738 std::vector<resolution>::iterator
begin() {
return resolutions.begin(); }
9741 std::vector<resolution>::iterator
end() {
return resolutions.end(); }
9743 bool includes_last_item_in_range;
9744 int indexed_paging_offset;
9745 int numerator_offset;
9746 int absolute_denominator;
9747 int total_items_in_view;
9748 std::vector<resolution> resolutions;
9751 #if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 9752 defined(EWS_HAS_CXX17_STATIC_ASSERT) 9753 static_assert(std::is_default_constructible<resolution_set>::value);
9754 static_assert(std::is_copy_constructible<resolution_set>::value);
9755 static_assert(std::is_copy_assignable<resolution_set>::value);
9756 static_assert(std::is_move_constructible<resolution_set>::value);
9757 static_assert(std::is_move_assignable<resolution_set>::value);
9760 #ifdef EWS_HAS_VARIANT 9761 class subscription_information final
9765 # ifdef EWS_HAS_DEFAULT_AND_DELETE 9766 subscription_information() =
default;
9768 subscription_information() {}
9770 subscription_information(std::string
id, std::string mark)
9771 : subscription_id_(std::move(
id)), watermark_(std::move(mark))
9775 const std::string& get_subscription_id()
const EWS_NOEXCEPT
9777 return subscription_id_;
9779 const std::string& get_watermark()
const EWS_NOEXCEPT {
return watermark_; }
9782 std::string subscription_id_;
9783 std::string watermark_;
9786 # if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 9787 defined(EWS_HAS_CXX17_STATIC_ASSERT) 9788 static_assert(std::is_default_constructible<subscription_information>::value);
9789 static_assert(std::is_copy_constructible<subscription_information>::value);
9790 static_assert(std::is_copy_assignable<subscription_information>::value);
9791 static_assert(std::is_move_constructible<subscription_information>::value);
9792 static_assert(std::is_move_assignable<subscription_information>::value);
9803 #ifdef EWS_HAS_DEFAULT_AND_DELETE 9812 explicit folder_id(std::string
id) : id_(std::move(
id)), change_key_() {}
9814 folder_id(std::string
id, std::string change_key)
9815 : id_(std::move(
id)), change_key_(std::move(change_key))
9819 std::string to_xml()
const {
return this->to_xml_impl(); }
9822 const std::string&
id() const EWS_NOEXCEPT {
return id_; }
9825 const std::string&
change_key() const EWS_NOEXCEPT {
return change_key_; }
9828 bool valid() const EWS_NOEXCEPT {
return !id_.empty(); }
9833 auto id_attr = elem.first_attribute(
"Id");
9834 check(id_attr,
"Expected <Id> to have an Id attribute");
9835 auto id = std::string(id_attr->value(), id_attr->value_size());
9837 std::string change_key;
9838 auto ck_attr = elem.first_attribute(
"ChangeKey");
9841 change_key = std::string(ck_attr->value(), ck_attr->value_size());
9843 return folder_id(std::move(
id), std::move(change_key));
9846 #ifndef EWS_DOXYGEN_SHOULD_SKIP_THIS 9848 virtual std::string to_xml_impl()
const 9850 std::stringstream sstr;
9852 <<
"FolderId Id=\"" << id_;
9853 if (!change_key_.empty())
9855 sstr <<
"\" ChangeKey=\"" << change_key_;
9864 std::string change_key_;
9867 #if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 9868 defined(EWS_HAS_CXX17_STATIC_ASSERT) 9869 static_assert(std::is_default_constructible<folder_id>::value);
9870 static_assert(std::is_copy_constructible<folder_id>::value);
9871 static_assert(std::is_copy_assignable<folder_id>::value);
9872 static_assert(std::is_move_constructible<folder_id>::value);
9873 static_assert(std::is_move_assignable<folder_id>::value);
9882 #ifdef EWS_HAS_DEFAULT_AND_DELETE 9898 :
folder_id(well_known_name(folder), std::move(change_key))
9916 :
folder_id(well_known_name(folder)), owner_(std::move(owner))
9923 if (name ==
"calendar")
9927 else if (name ==
"contacts")
9931 else if (name ==
"deleteditems")
9935 else if (name ==
"drafts")
9939 else if (name ==
"inbox")
9943 else if (name ==
"journal")
9947 else if (name ==
"notes")
9951 else if (name ==
"outbox")
9955 else if (name ==
"sentitems")
9959 else if (name ==
"tasks")
9963 else if (name ==
"msgfolderroot")
9967 else if (name ==
"root")
9971 else if (name ==
"junkemail")
9975 else if (name ==
"searchfolders")
9979 else if (name ==
"voicemail")
9983 else if (name ==
"recoverableitemsroot")
9987 else if (name ==
"recoverableitemsdeletions")
9991 else if (name ==
"recoverableitemsversions")
9995 else if (name ==
"recoverableitemspurges")
9999 else if (name ==
"archiveroot")
10003 else if (name ==
"archivemsgfolderroot")
10007 else if (name ==
"archivedeleteditems")
10011 else if (name ==
"archiveinbox")
10015 else if (name ==
"archiverecoverableitemsroot")
10019 else if (name ==
"archiverecoverableitemsdeletions")
10023 else if (name ==
"archiverecoverableitemsversions")
10027 else if (name ==
"archiverecoverableitemspurges")
10031 else if (name ==
"syncissues")
10035 else if (name ==
"conflicts")
10039 else if (name ==
"localfailures")
10043 else if (name ==
"serverfailures")
10047 else if (name ==
"recipientcache")
10051 else if (name ==
"quickcontacts")
10055 else if (name ==
"conversationhistory")
10059 else if (name ==
"adminauditlogs")
10063 else if (name ==
"todosearch")
10067 else if (name ==
"mycontacts")
10071 else if (name ==
"directory")
10075 else if (name ==
"imcontactlist")
10079 else if (name ==
"peopleconnect")
10083 else if (name ==
"favorites")
10088 throw exception(
"Unrecognized folder name");
10095 switch (enumeration)
10106 name =
"deleteditems";
10130 name =
"sentitems";
10138 name =
"msgfolderroot";
10146 name =
"junkemail";
10150 name =
"searchfolders";
10154 name =
"voicemail";
10158 name =
"recoverableitemsroot";
10162 name =
"recoverableitemsdeletions";
10166 name =
"recoverableitemsversions";
10170 name =
"recoverableitemspurges";
10174 name =
"archiveroot";
10178 name =
"archivemsgfolderroot";
10182 name =
"archivedeleteditems";
10186 name =
"archiveinbox";
10190 name =
"archiverecoverableitemsroot";
10194 name =
"archiverecoverableitemsdeletions";
10198 name =
"archiverecoverableitemsversions";
10202 name =
"archiverecoverableitemspurges";
10206 name =
"syncissues";
10210 name =
"conflicts";
10214 name =
"localfailures";
10218 name =
"serverfailures";
10222 name =
"recipientcache";
10226 name =
"quickcontacts";
10230 name =
"conversationhistory";
10234 name =
"adminauditlogs";
10238 name =
"todosearch";
10242 name =
"mycontacts";
10246 name =
"directory";
10250 name =
"imcontactlist";
10254 name =
"peopleconnect";
10258 name =
"favorites";
10262 throw exception(
"Unrecognized folder name");
10268 #ifdef EWS_HAS_OPTIONAL 10269 std::optional<mailbox> owner_;
10271 internal::optional<mailbox> owner_;
10274 std::string to_xml_impl()
const override 10276 std::stringstream sstr;
10277 sstr <<
"<t:DistinguishedFolderId Id=\"";
10280 if (owner_.has_value())
10283 sstr << owner_.value().to_xml();
10284 sstr <<
"</t:DistinguishedFolderId>";
10288 if (!change_key().empty())
10290 sstr <<
"\" ChangeKey=\"" << change_key();
10298 #if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 10299 defined(EWS_HAS_CXX17_STATIC_ASSERT) 10300 static_assert(std::is_default_constructible<distinguished_folder_id>::value);
10301 static_assert(std::is_copy_constructible<distinguished_folder_id>::value);
10302 static_assert(std::is_copy_assignable<distinguished_folder_id>::value);
10303 static_assert(std::is_move_constructible<distinguished_folder_id>::value);
10304 static_assert(std::is_move_assignable<distinguished_folder_id>::value);
10307 #ifdef EWS_HAS_VARIANT 10313 const event_type& get_type()
const EWS_NOEXCEPT {
return type_; }
10314 const std::string& get_watermark()
const EWS_NOEXCEPT
10321 std::string watermark_;
10325 class copied_event final :
public internal::event_base
10328 # ifdef EWS_HAS_DEFAULT_AND_DELETE 10329 copied_event() =
default;
10334 static copied_event from_xml_element(
const rapidxml::xml_node<>& elem)
10336 using rapidxml::internal::compare;
10338 std::string watermark;
10339 std::string timestamp;
10346 for (
auto node = elem.first_node(); node; node = node->next_sibling())
10348 if (compare(node->local_name(), node->local_name_size(),
10349 "Watermark", strlen(
"Watermark")))
10351 watermark = std::string(node->value(), node->value_size());
10353 if (compare(node->local_name(), node->local_name_size(),
10354 "TimeStamp", strlen(
"TimeStamp")))
10356 timestamp = std::string(node->value(), node->value_size());
10358 if (compare(node->local_name(), node->local_name_size(),
10359 "ParentFolderId", strlen(
"ParentFolderId")))
10363 if (compare(node->local_name(), node->local_name_size(),
10364 "OldParentFolderId", strlen(
"OldParentFolderId")))
10368 if (compare(node->local_name(), node->local_name_size(),
"ItemId",
10373 if (compare(node->local_name(), node->local_name_size(),
10374 "OldItemId", strlen(
"OldItemId")))
10378 if (compare(node->local_name(), node->local_name_size(),
"FolderId",
10379 strlen(
"FolderId")))
10383 if (compare(node->local_name(), node->local_name_size(),
10384 "OldFolderId", strlen(
"OldFolderId")))
10389 e.type_ = event_type::copied_event;
10390 e.watermark_ = watermark;
10391 e.timestamp_ = timestamp;
10393 e.old_item_id_ = old_id;
10394 e.folder_id_ = f_id;
10395 e.old_folder_id_ = old_f_id;
10396 e.parent_folder_id_ = parent_folder_id;
10397 e.old_parent_folder_id_ = old_parent_folder_id;
10402 const std::string& get_timestamp()
const EWS_NOEXCEPT {
return timestamp_; }
10403 const item_id& get_item_id()
const EWS_NOEXCEPT {
return id_; }
10404 const item_id& get_old_item_id()
const EWS_NOEXCEPT {
return old_item_id_; }
10405 const folder_id& get_folder_id()
const EWS_NOEXCEPT {
return folder_id_; }
10406 const folder_id& get_old_folder_id()
const EWS_NOEXCEPT
10408 return old_folder_id_;
10410 const folder_id& get_parent_folder_id()
const EWS_NOEXCEPT
10412 return parent_folder_id_;
10414 const folder_id& get_old_parent_folder_id()
const EWS_NOEXCEPT
10416 return old_parent_folder_id_;
10420 std::string timestamp_;
10430 class created_event final :
public internal::event_base
10433 # ifdef EWS_HAS_DEFAULT_AND_DELETE 10434 created_event() =
default;
10438 static created_event from_xml_element(
const rapidxml::xml_node<>& elem)
10440 using rapidxml::internal::compare;
10442 std::string watermark;
10443 std::string timestamp;
10447 for (
auto node = elem.first_node(); node; node = node->next_sibling())
10449 if (compare(node->local_name(), node->local_name_size(),
10450 "Watermark", strlen(
"Watermark")))
10452 watermark = std::string(node->value(), node->value_size());
10454 if (compare(node->local_name(), node->local_name_size(),
10455 "TimeStamp", strlen(
"TimeStamp")))
10457 timestamp = std::string(node->value(), node->value_size());
10459 if (compare(node->local_name(), node->local_name_size(),
10460 "ParentFolderId", strlen(
"ParentFolderId")))
10464 if (compare(node->local_name(), node->local_name_size(),
"ItemId",
10469 if (compare(node->local_name(), node->local_name_size(),
"FolderId",
10470 strlen(
"FolderId")))
10475 e.type_ = event_type::created_event;
10476 e.watermark_ = watermark;
10477 e.timestamp_ = timestamp;
10479 e.folder_id_ = f_id;
10480 e.parent_folder_id_ = parent_folder_id;
10484 const std::string& get_timestamp()
const EWS_NOEXCEPT {
return timestamp_; }
10485 const item_id& get_item_id()
const EWS_NOEXCEPT {
return id_; }
10486 const folder_id& get_folder_id()
const EWS_NOEXCEPT {
return folder_id_; }
10487 const folder_id& get_parent_folder_id()
const EWS_NOEXCEPT
10489 return parent_folder_id_;
10493 std::string timestamp_;
10500 class deleted_event final :
public internal::event_base
10503 # ifdef EWS_HAS_DEFAULT_AND_DELETE 10504 deleted_event() =
default;
10509 static deleted_event from_xml_element(
const rapidxml::xml_node<>& elem)
10511 using rapidxml::internal::compare;
10513 std::string watermark;
10514 std::string timestamp;
10518 for (
auto node = elem.first_node(); node; node = node->next_sibling())
10520 if (compare(node->local_name(), node->local_name_size(),
10521 "Watermark", strlen(
"Watermark")))
10523 watermark = std::string(node->value(), node->value_size());
10525 if (compare(node->local_name(), node->local_name_size(),
10526 "TimeStamp", strlen(
"TimeStamp")))
10528 timestamp = std::string(node->value(), node->value_size());
10530 if (compare(node->local_name(), node->local_name_size(),
10531 "ParentFolderId", strlen(
"ParentFolderId")))
10535 if (compare(node->local_name(), node->local_name_size(),
"ItemId",
10540 if (compare(node->local_name(), node->local_name_size(),
"FolderId",
10541 strlen(
"FolderId")))
10546 e.type_ = event_type::deleted_event;
10547 e.watermark_ = watermark;
10548 e.timestamp_ = timestamp;
10550 e.folder_id_ = f_id;
10551 e.parent_folder_id_ = parent_folder_id;
10556 const std::string& get_timestamp()
const EWS_NOEXCEPT {
return timestamp_; }
10557 const item_id& get_item_id()
const EWS_NOEXCEPT {
return id_; }
10558 const folder_id& get_folder_id()
const EWS_NOEXCEPT {
return folder_id_; }
10559 const folder_id& get_parent_folder_id()
const EWS_NOEXCEPT
10561 return parent_folder_id_;
10565 std::string timestamp_;
10572 class modified_event final :
public internal::event_base
10575 modified_event() : unread_count_(0) {}
10577 static modified_event from_xml_element(
const rapidxml::xml_node<>& elem)
10579 using rapidxml::internal::compare;
10581 std::string watermark;
10582 std::string timestamp;
10586 int unread_count = 0;
10587 for (
auto node = elem.first_node(); node; node = node->next_sibling())
10589 if (compare(node->local_name(), node->local_name_size(),
10590 "Watermark", strlen(
"Watermark")))
10592 watermark = std::string(node->value(), node->value_size());
10594 if (compare(node->local_name(), node->local_name_size(),
10595 "TimeStamp", strlen(
"TimeStamp")))
10597 timestamp = std::string(node->value(), node->value_size());
10599 if (compare(node->local_name(), node->local_name_size(),
10600 "ParentFolderId", strlen(
"ParentFolderId")))
10604 if (compare(node->local_name(), node->local_name_size(),
10605 "UnreadCount", strlen(
"UnreadCount")))
10607 unread_count = int(*node->value());
10609 if (compare(node->local_name(), node->local_name_size(),
"ItemId",
10614 if (compare(node->local_name(), node->local_name_size(),
"FolderId",
10615 strlen(
"FolderId")))
10620 e.type_ = event_type::modified_event;
10621 e.watermark_ = watermark;
10622 e.timestamp_ = timestamp;
10624 e.folder_id_ = f_id;
10625 e.parent_folder_id_ = parent_folder_id;
10626 e.unread_count_ = unread_count;
10631 const std::string& get_timestamp()
const EWS_NOEXCEPT {
return timestamp_; }
10632 const item_id& get_item_id()
const EWS_NOEXCEPT {
return id_; }
10633 const folder_id& get_folder_id()
const EWS_NOEXCEPT {
return folder_id_; }
10634 const folder_id& get_parent_folder_id()
const EWS_NOEXCEPT
10636 return parent_folder_id_;
10638 const int& get_unread_count()
const EWS_NOEXCEPT {
return unread_count_; }
10641 std::string timestamp_;
10649 class moved_event final :
public internal::event_base
10652 # ifdef EWS_HAS_DEFAULT_AND_DELETE 10653 moved_event() =
default;
10658 static moved_event from_xml_element(
const rapidxml::xml_node<>& elem)
10660 using rapidxml::internal::compare;
10662 std::string watermark;
10663 std::string timestamp;
10670 for (
auto node = elem.first_node(); node; node = node->next_sibling())
10672 if (compare(node->local_name(), node->local_name_size(),
10673 "Watermark", strlen(
"Watermark")))
10675 watermark = std::string(node->value(), node->value_size());
10677 if (compare(node->local_name(), node->local_name_size(),
10678 "TimeStamp", strlen(
"TimeStamp")))
10680 timestamp = std::string(node->value(), node->value_size());
10682 if (compare(node->local_name(), node->local_name_size(),
10683 "ParentFolderId", strlen(
"ParentFolderId")))
10687 if (compare(node->local_name(), node->local_name_size(),
"ItemId",
10692 if (compare(node->local_name(), node->local_name_size(),
10693 "OldItemId", strlen(
"OldItemId")))
10697 if (compare(node->local_name(), node->local_name_size(),
"FolderId",
10698 strlen(
"FolderId")))
10702 if (compare(node->local_name(), node->local_name_size(),
10703 "OldFolderId", strlen(
"OldFolderId")))
10707 if (compare(node->local_name(), node->local_name_size(),
10708 "OldParentFolderId", strlen(
"OldParentFolderId")))
10713 e.type_ = event_type::moved_event;
10714 e.watermark_ = watermark;
10715 e.timestamp_ = timestamp;
10717 e.old_item_id_ = old_id;
10718 e.folder_id_ = f_id;
10719 e.old_folder_id_ = old_f_id;
10720 e.parent_folder_id_ = parent_folder_id;
10721 e.old_parent_folder_id_ = old_parent_folder_id;
10726 const std::string& get_timestamp()
const EWS_NOEXCEPT {
return timestamp_; }
10727 const item_id& get_item_id()
const EWS_NOEXCEPT {
return id_; }
10728 const item_id& get_old_item_id()
const EWS_NOEXCEPT {
return old_item_id_; }
10729 const folder_id& get_folder_id()
const EWS_NOEXCEPT {
return folder_id_; }
10730 const folder_id& get_old_folder_id()
const EWS_NOEXCEPT
10732 return old_folder_id_;
10734 const folder_id& get_parent_folder_id()
const EWS_NOEXCEPT
10736 return parent_folder_id_;
10738 const folder_id& get_old_parent_folder_id()
const EWS_NOEXCEPT
10740 return old_parent_folder_id_;
10744 std::string timestamp_;
10754 class new_mail_event final :
public internal::event_base
10757 # ifdef EWS_HAS_DEFAULT_AND_DELETE 10758 new_mail_event() =
default;
10760 new_mail_event() {}
10763 static new_mail_event from_xml_element(
const rapidxml::xml_node<>& elem)
10765 using rapidxml::internal::compare;
10767 std::string watermark;
10768 std::string timestamp;
10771 for (
auto node = elem.first_node(); node; node = node->next_sibling())
10773 if (compare(node->local_name(), node->local_name_size(),
10774 "Watermark", strlen(
"Watermark")))
10776 watermark = std::string(node->value(), node->value_size());
10778 if (compare(node->local_name(), node->local_name_size(),
10779 "TimeStamp", strlen(
"TimeStamp")))
10781 timestamp = std::string(node->value(), node->value_size());
10783 if (compare(node->local_name(), node->local_name_size(),
10784 "ParentFolderId", strlen(
"ParentFolderId")))
10788 if (compare(node->local_name(), node->local_name_size(),
"ItemId",
10794 e.type_ = event_type::new_mail_event;
10795 e.watermark_ = watermark;
10796 e.timestamp_ = timestamp;
10798 e.parent_folder_id_ = parent_folder_id;
10803 const std::string& get_timestamp()
const EWS_NOEXCEPT {
return timestamp_; }
10804 const item_id& get_item_id()
const EWS_NOEXCEPT {
return id_; }
10805 const folder_id& get_parent_folder_id()
const EWS_NOEXCEPT
10807 return parent_folder_id_;
10811 std::string timestamp_;
10817 class status_event final :
public internal::event_base
10820 # ifdef EWS_HAS_DEFAULT_AND_DELETE 10821 status_event() =
default;
10825 static status_event from_xml_element(
const rapidxml::xml_node<>& elem)
10827 using rapidxml::internal::compare;
10829 std::string watermark;
10830 for (
auto node = elem.first_node(); node; node = node->next_sibling())
10832 if (compare(node->local_name(), node->local_name_size(),
10833 "Watermark", strlen(
"Watermark")))
10835 watermark = std::string(node->value(), node->value_size());
10838 e.type_ = event_type::new_mail_event;
10839 e.watermark_ = watermark;
10845 class free_busy_changed_event final :
public internal::event_base
10848 # ifdef EWS_HAS_DEFAULT_AND_DELETE 10849 free_busy_changed_event() =
default;
10851 free_busy_changed_event() {}
10854 static free_busy_changed_event
10855 from_xml_element(
const rapidxml::xml_node<>& elem)
10857 using rapidxml::internal::compare;
10858 free_busy_changed_event e;
10859 std::string watermark;
10860 std::string timestamp;
10863 for (
auto node = elem.first_node(); node; node = node->next_sibling())
10865 if (compare(node->local_name(), node->local_name_size(),
10866 "Watermark", strlen(
"Watermark")))
10868 watermark = std::string(node->value(), node->value_size());
10870 if (compare(node->local_name(), node->local_name_size(),
10871 "TimeStamp", strlen(
"TimeStamp")))
10873 timestamp = std::string(node->value(), node->value_size());
10875 if (compare(node->local_name(), node->local_name_size(),
10876 "ParentFolderId", strlen(
"ParentFolderId")))
10880 if (compare(node->local_name(), node->local_name_size(),
"ItemId",
10886 e.type_ = event_type::free_busy_changed_event;
10887 e.watermark_ = watermark;
10888 e.timestamp_ = timestamp;
10890 e.parent_folder_id_ = parent_folder_id;
10895 const std::string& get_timestamp()
const EWS_NOEXCEPT {
return timestamp_; }
10896 const item_id& get_item_id()
const EWS_NOEXCEPT {
return id_; }
10897 const folder_id& get_parent_folder_id()
const EWS_NOEXCEPT
10899 return parent_folder_id_;
10903 std::string timestamp_;
10909 typedef std::variant<copied_event, created_event, deleted_event, modified_event,
10910 moved_event, new_mail_event, status_event,
10911 free_busy_changed_event>
10915 struct notification final
10917 std::string subscription_id;
10918 std::string previous_watermark;
10920 std::vector<event> events;
10947 const auto node = get_node(
"AttachmentId");
10954 const auto node = get_node(
"Name");
10955 return node ? std::string(node->value(), node->value_size()) :
"";
10966 using rapidxml::internal::compare;
10968 const auto attachment_node = xml_.root();
10969 if (!attachment_node)
10974 for (
auto child = attachment_node->first_node(); child !=
nullptr;
10975 child = child->next_sibling())
10977 for (
auto inner = child->first_node(); inner !=
nullptr;
10978 inner = inner->next_sibling())
10980 if (compare(inner->local_name(), inner->local_name_size(),
10981 "MimeContent", strlen(
"MimeContent")))
10983 return std::string(inner->value(), inner->value_size());
10993 const auto node = get_node(
"ContentType");
10994 return node ? std::string(node->value(), node->value_size()) :
"";
11004 const auto node = get_node(
"Content");
11005 return node ? std::string(node->value(), node->value_size()) :
"";
11014 const auto node = get_node(
"Size");
11019 auto size = std::string(node->value(), node->value_size());
11020 return size.empty() ? 0U : std::stoul(size);
11030 const auto node = get_node(
"ContentId");
11031 return node ? std::string(node->value(), node->value_size()) :
"";
11037 const auto node = get_node(
"IsInline");
11042 using rapidxml::internal::compare;
11043 return compare(node->value(), node->value_size(),
"true",
11057 if (get_type() == type::item)
11062 const auto raw_bytes = internal::base64::decode(content());
11064 std::ofstream ofstr(file_path, std::ofstream::out | std::ios::binary);
11065 if (!ofstr.is_open())
11067 if (file_path.empty())
11070 "Could not open file for writing: no file name given");
11073 throw exception(
"Could not open file for writing: " + file_path);
11076 std::copy(begin(raw_bytes),
end(raw_bytes),
11077 std::ostreambuf_iterator<char>(ofstr));
11079 return raw_bytes.size();
11083 std::string
to_xml()
const {
return xml_.to_string(); }
11088 const auto elem_name =
11089 std::string(elem.local_name(), elem.local_name_size());
11090 check((elem_name ==
"FileAttachment" || elem_name ==
"ItemAttachment"),
11091 "Expected <FileAttachment> or <ItemAttachment>");
11092 return attachment(elem_name ==
"FileAttachment" ? type::file
11094 internal::xml_subtree(elem));
11113 std::string content_type, std::string name)
11115 using internal::create_node;
11118 obj.type_ = type::file;
11120 auto& attachment_node =
11121 create_node(*obj.xml_.document(),
"t:FileAttachment");
11122 create_node(attachment_node,
"t:Name", name);
11123 create_node(attachment_node,
"t:ContentType", content_type);
11124 create_node(attachment_node,
"t:Content", content);
11125 create_node(attachment_node,
"t:Size", std::to_string(content.size()));
11145 std::string content_type, std::string name)
11147 using internal::create_node;
11150 std::ifstream ifstr(file_path, std::ifstream::in | std::ios::binary);
11151 if (!ifstr.is_open())
11153 throw exception(
"Could not open file for reading: " + file_path);
11157 ifstr.unsetf(std::ios::skipws);
11160 ifstr.seekg(0, std::ios::end);
11161 const auto file_size = ifstr.tellg();
11162 ifstr.seekg(0, std::ios::beg);
11165 auto buffer = std::vector<unsigned char>();
11167 internal::numeric_cast<std::vector<unsigned char>::size_type>(
11171 buffer.insert(begin(buffer),
11172 std::istream_iterator<unsigned char>(ifstr),
11173 std::istream_iterator<unsigned char>());
11177 auto content = internal::base64::encode(buffer);
11180 obj.type_ = type::file;
11182 auto& attachment_node =
11183 create_node(*obj.xml_.document(),
"t:FileAttachment");
11184 create_node(attachment_node,
"t:Name", name);
11185 create_node(attachment_node,
"t:ContentType", content_type);
11186 create_node(attachment_node,
"t:Content", content);
11187 create_node(attachment_node,
"t:Size", std::to_string(buffer.size()));
11193 const std::string& name);
11197 internal::xml_subtree xml_;
11201 : xml_(std::move(xml)), type_(std::move(t))
11205 rapidxml::xml_node<>* get_node(
const char* local_name)
const 11207 using rapidxml::internal::compare;
11209 const auto attachment_node = xml_.root();
11210 if (!attachment_node)
11215 rapidxml::xml_node<>* node =
nullptr;
11216 for (
auto child = attachment_node->first_node(); child !=
nullptr;
11217 child = child->next_sibling())
11219 if (compare(child->local_name(), child->local_name_size(),
11220 local_name, strlen(local_name)))
11230 #if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 11231 defined(EWS_HAS_CXX17_STATIC_ASSERT) 11232 static_assert(std::is_default_constructible<attachment>::value);
11233 static_assert(std::is_copy_constructible<attachment>::value);
11234 static_assert(std::is_copy_assignable<attachment>::value);
11235 static_assert(std::is_move_constructible<attachment>::value);
11236 static_assert(std::is_move_assignable<attachment>::value);
11242 inline response_result
11243 parse_response_class_and_code(
const rapidxml::xml_node<>& elem)
11245 using rapidxml::internal::compare;
11248 auto response_class_attr = elem.first_attribute(
"ResponseClass");
11249 if (compare(response_class_attr->value(),
11250 response_class_attr->value_size(),
"Error", 5))
11254 else if (compare(response_class_attr->value(),
11255 response_class_attr->value_size(),
"Warning", 7))
11268 auto response_code_elem = elem.first_node_ns(
11269 uri<>::microsoft::messages(),
"ResponseCode");
11270 check(response_code_elem,
"Expected <ResponseCode> element");
11271 code = str_to_response_code(response_code_elem->value());
11273 auto message_text_elem =
11274 elem.first_node_ns(uri<>::microsoft::messages(),
"MessageText");
11275 if (message_text_elem)
11277 return response_result(
11279 std::string(message_text_elem->value(),
11280 message_text_elem->value_size()));
11284 return response_result(cls, code);
11293 template <
typename Func>
11294 inline void for_each_child_node(
const rapidxml::xml_node<>& parent_node,
11297 for (
auto child = parent_node.first_node(); child;
11298 child = child->next_sibling())
11304 template <
typename Func>
11305 inline void for_each_attribute(
const rapidxml::xml_node<>& node, Func func)
11307 for (
auto attrib = node.first_attribute(); attrib;
11308 attrib = attrib->next_attribute())
11318 check_response_message_for_error(
const rapidxml::xml_node<>& element)
11320 using rapidxml::internal::compare;
11322 auto response_class_attr = element.first_attribute(
"ResponseClass");
11324 if (compare(response_class_attr->value(),
11325 response_class_attr->value_size(),
"Error", 5))
11329 auto rcode_elem = element.first_node_ns(
11330 uri<>::microsoft::messages(),
"ResponseCode");
11331 check(rcode_elem,
"Expected <ResponseCode> element");
11333 code = str_to_response_code(rcode_elem->value());
11334 auto message_text = element.first_node_ns(
11335 uri<>::microsoft::messages(),
"MessageText");
11340 std::string(message_text->value(),
11341 message_text->value_size()));
11349 class response_message_base
11352 explicit response_message_base(response_result&& res)
11353 : res_(std::move(res))
11357 const response_result& result()
const EWS_NOEXCEPT {
return res_; }
11359 bool success()
const EWS_NOEXCEPT
11365 response_result res_;
11382 template <
typename ItemType>
11383 class response_message_with_items :
public response_message_base
11386 typedef ItemType item_type;
11388 response_message_with_items(response_result&& res,
11389 std::vector<item_type>&& items)
11390 : response_message_base(std::move(res)), items_(std::move(items))
11394 const std::vector<item_type>& items()
const EWS_NOEXCEPT
11400 std::vector<item_type> items_;
11403 class create_folder_response_message final
11404 :
public response_message_with_items<folder_id>
11408 static create_folder_response_message parse(http_response&&);
11411 create_folder_response_message(response_result&& res,
11412 std::vector<folder_id>&& items)
11413 : response_message_with_items<folder_id>(std::move(res),
11419 class create_item_response_message final
11420 :
public response_message_with_items<item_id>
11424 static create_item_response_message parse(http_response&&);
11427 create_item_response_message(response_result&& res,
11428 std::vector<item_id>&& items)
11429 : response_message_with_items<item_id>(std::move(res),
11435 class find_folder_response_message final
11436 :
public response_message_with_items<folder_id>
11440 static find_folder_response_message parse(http_response&&);
11443 find_folder_response_message(response_result&& res,
11444 std::vector<folder_id>&& items)
11445 : response_message_with_items<folder_id>(std::move(res),
11451 class find_item_response_message final
11452 :
public response_message_with_items<item_id>
11456 static find_item_response_message parse(http_response&&);
11459 find_item_response_message(response_result&& res,
11460 std::vector<item_id>&& items)
11461 : response_message_with_items<item_id>(std::move(res),
11467 class find_calendar_item_response_message final
11468 :
public response_message_with_items<calendar_item>
11472 static find_calendar_item_response_message parse(http_response&&);
11475 find_calendar_item_response_message(response_result&& res,
11476 std::vector<calendar_item>&& items)
11477 : response_message_with_items<calendar_item>(std::move(res),
11483 class update_item_response_message final
11484 :
public response_message_with_items<item_id>
11488 static update_item_response_message parse(http_response&&);
11491 update_item_response_message(response_result&& res,
11492 std::vector<item_id>&& items)
11493 : response_message_with_items<item_id>(std::move(res),
11499 class update_folder_response_message final
11500 :
public response_message_with_items<folder_id>
11504 static update_folder_response_message parse(http_response&&);
11507 update_folder_response_message(response_result&& res,
11508 std::vector<folder_id>&& items)
11509 : response_message_with_items<folder_id>(std::move(res),
11515 class get_folder_response_message final
11516 :
public response_message_with_items<folder>
11520 static get_folder_response_message parse(http_response&&);
11523 get_folder_response_message(response_result&& res,
11524 std::vector<folder>&& items)
11525 : response_message_with_items<folder>(std::move(res),
11531 class folder_response_message final
11534 typedef std::tuple<response_class, response_code, std::vector<folder>>
11537 std::vector<folder> items()
const 11539 std::vector<folder> items;
11540 items.reserve(messages_.size());
11542 for (
const auto& msg : messages_)
11544 const auto& msg_items = std::get<2>(msg);
11545 std::copy(begin(msg_items),
end(msg_items),
11546 std::back_inserter(items));
11557 return std::all_of(begin(messages_),
end(messages_),
11558 [](
const response_message& msg) {
11559 return std::get<0>(msg) ==
11566 auto it = std::find_if_not(begin(messages_),
end(messages_),
11567 [](
const response_message& msg) {
11568 return std::get<0>(msg) ==
11572 : std::get<1>(*it);
11576 static folder_response_message parse(http_response&&);
11579 explicit folder_response_message(
11580 std::vector<response_message>&& messages)
11581 : messages_(std::move(messages))
11585 std::vector<response_message> messages_;
11588 class get_room_lists_response_message final
11589 :
public response_message_with_items<mailbox>
11593 static get_room_lists_response_message parse(http_response&&);
11596 get_room_lists_response_message(response_result&& res,
11597 std::vector<mailbox>&& items)
11598 : response_message_with_items<mailbox>(std::move(res),
11604 class get_rooms_response_message final
11605 :
public response_message_with_items<mailbox>
11609 static get_rooms_response_message parse(http_response&&);
11612 get_rooms_response_message(response_result&& res,
11613 std::vector<mailbox>&& items)
11614 : response_message_with_items<mailbox>(std::move(res),
11620 template <
typename ItemType>
11621 class get_item_response_message final
11622 :
public response_message_with_items<ItemType>
11626 static get_item_response_message parse(http_response&&);
11629 get_item_response_message(response_result&& res,
11630 std::vector<ItemType>&& items)
11631 : response_message_with_items<ItemType>(std::move(res),
11637 template <
typename IdType>
class response_message_with_ids
11640 typedef IdType id_type;
11641 typedef std::tuple<response_class, response_code, std::vector<id_type>>
11644 explicit response_message_with_ids(
11645 std::vector<response_message>&& messages)
11646 : messages_(std::move(messages))
11650 std::vector<id_type> items()
const 11652 std::vector<id_type> items;
11653 items.reserve(messages_.size());
11655 for (
const auto& msg : messages_)
11657 const auto& msg_items = std::get<2>(msg);
11658 std::copy(begin(msg_items),
end(msg_items),
11659 std::back_inserter(items));
11670 return std::all_of(begin(messages_),
end(messages_),
11671 [](
const response_message& msg) {
11672 return std::get<0>(msg) ==
11679 auto it = std::find_if_not(begin(messages_),
end(messages_),
11680 [](
const response_message& msg) {
11681 return std::get<0>(msg) ==
11685 : std::get<1>(*it);
11689 std::vector<response_message> messages_;
11692 class move_item_response_message final
11693 :
public response_message_with_ids<item_id>
11697 static move_item_response_message parse(http_response&&);
11700 move_item_response_message(std::vector<response_message>&& items)
11701 : response_message_with_ids<item_id>(std::move(items))
11706 class move_folder_response_message final
11707 :
public response_message_with_ids<folder_id>
11711 static move_folder_response_message parse(http_response&&);
11714 move_folder_response_message(std::vector<response_message>&& items)
11715 : response_message_with_ids<folder_id>(std::move(items))
11720 template <
typename ItemType>
class item_response_messages final
11723 typedef ItemType item_type;
11725 std::vector<item_type>>
11728 std::vector<item_type> items()
const 11730 std::vector<item_type> items;
11731 items.reserve(messages_.size());
11733 for (
const auto& msg : messages_)
11735 const auto& msg_items = std::get<2>(msg);
11736 std::copy(begin(msg_items),
end(msg_items),
11737 std::back_inserter(items));
11748 return std::all_of(begin(messages_),
end(messages_),
11749 [](
const response_message& msg) {
11750 return std::get<0>(msg) ==
11755 response_code first_error_or_warning()
const 11757 auto it = std::find_if_not(begin(messages_),
end(messages_),
11758 [](
const response_message& msg) {
11759 return std::get<0>(msg) ==
11763 : std::get<1>(*it);
11767 static item_response_messages parse(http_response&&);
11770 explicit item_response_messages(
11771 std::vector<response_message>&& messages)
11772 : messages_(std::move(messages))
11776 std::vector<response_message> messages_;
11779 class delegate_response_message :
public response_message_base
11782 const std::vector<delegate_user>& get_delegates()
const EWS_NOEXCEPT
11788 delegate_response_message(response_result&& res,
11789 std::vector<delegate_user>&& delegates)
11790 : response_message_base(std::move(res)),
11791 delegates_(std::move(delegates))
11796 static std::vector<delegate_user>
11797 parse_users(
const rapidxml::xml_node<>& response_element);
11799 std::vector<delegate_user> delegates_;
11802 class add_delegate_response_message final :
public delegate_response_message
11806 static add_delegate_response_message parse(http_response&&);
11809 add_delegate_response_message(response_result&& res,
11810 std::vector<delegate_user>&& delegates)
11811 : delegate_response_message(std::move(res), std::move(delegates))
11816 class get_delegate_response_message final :
public delegate_response_message
11820 static get_delegate_response_message parse(http_response&&);
11823 get_delegate_response_message(response_result&& res,
11824 std::vector<delegate_user>&& delegates)
11825 : delegate_response_message(std::move(res), std::move(delegates))
11830 class remove_delegate_response_message final :
public response_message_base
11834 static remove_delegate_response_message parse(http_response&&);
11837 explicit remove_delegate_response_message(response_result&& res)
11838 : response_message_base(std::move(res))
11843 class resolve_names_response_message final :
public response_message_base
11847 static resolve_names_response_message parse(http_response&& response);
11850 return resolutions_;
11854 resolve_names_response_message(response_result&& res,
11856 : response_message_base(std::move(res)),
11857 resolutions_(std::move(rset))
11864 #ifdef EWS_HAS_VARIANT 11865 class subscribe_response_message final :
public response_message_base
11869 static subscribe_response_message parse(http_response&& response);
11870 const subscription_information& information()
const EWS_NOEXCEPT
11872 return information_;
11876 subscribe_response_message(response_result&& res,
11877 subscription_information&& info)
11878 : response_message_base(std::move(res)),
11879 information_(std::move(info))
11883 subscription_information information_;
11886 class unsubscribe_response_message final :
public response_message_base
11890 static unsubscribe_response_message parse(http_response&& response);
11893 unsubscribe_response_message(response_result&& res)
11894 : response_message_base(std::move(res))
11899 class get_events_response_message final :
public response_message_base
11903 static get_events_response_message parse(http_response&& response);
11904 const notification& get_notification()
const EWS_NOEXCEPT
11906 return notification_;
11910 get_events_response_message(response_result&& res, notification&& n)
11911 : response_message_base(std::move(res)), notification_(std::move(n))
11915 notification notification_;
11919 class create_attachment_response_message final
11920 :
public response_message_base
11923 static create_attachment_response_message
11924 parse(http_response&& response)
11926 const auto doc = parse_response(std::move(response));
11928 get_element_by_qname(*doc,
"CreateAttachmentResponseMessage",
11929 uri<>::microsoft::messages());
11931 check(elem,
"Expected <CreateAttachmentResponseMessage>");
11933 auto result = parse_response_class_and_code(*elem);
11935 auto attachments_element = elem->first_node_ns(
11936 uri<>::microsoft::messages(),
"Attachments");
11937 check(attachments_element,
"Expected <Attachments> element");
11939 auto ids = std::vector<attachment_id>();
11940 for (
auto attachment_elem = attachments_element->first_node();
11942 attachment_elem = attachment_elem->next_sibling())
11944 auto attachment_id_elem = attachment_elem->first_node_ns(
11945 uri<>::microsoft::types(),
"AttachmentId");
11946 check(attachment_id_elem,
11947 "Expected <AttachmentId> in response");
11951 return create_attachment_response_message(std::move(result),
11955 const std::vector<attachment_id>& attachment_ids()
const EWS_NOEXCEPT
11961 create_attachment_response_message(
11962 response_result&& res, std::vector<attachment_id>&& attachment_ids)
11963 : response_message_base(std::move(res)),
11964 ids_(std::move(attachment_ids))
11968 std::vector<attachment_id> ids_;
11971 class get_attachment_response_message final :
public response_message_base
11974 static get_attachment_response_message parse(http_response&& response)
11976 const auto doc = parse_response(std::move(response));
11978 get_element_by_qname(*doc,
"GetAttachmentResponseMessage",
11979 uri<>::microsoft::messages());
11981 check(elem,
"Expected <GetAttachmentResponseMessage>");
11983 auto result = parse_response_class_and_code(*elem);
11985 auto attachments_element = elem->first_node_ns(
11986 uri<>::microsoft::messages(),
"Attachments");
11987 check(attachments_element,
"Expected <Attachments> element");
11988 auto attachments = std::vector<attachment>();
11989 for (
auto attachment_elem = attachments_element->first_node();
11991 attachment_elem = attachment_elem->next_sibling())
11993 attachments.emplace_back(
11996 return get_attachment_response_message(std::move(result),
11997 std::move(attachments));
12000 const std::vector<attachment>& attachments()
const EWS_NOEXCEPT
12002 return attachments_;
12006 get_attachment_response_message(response_result&& res,
12007 std::vector<attachment>&& attachments)
12008 : response_message_base(std::move(res)),
12009 attachments_(std::move(attachments))
12013 std::vector<attachment> attachments_;
12016 class send_item_response_message final :
public response_message_base
12019 static send_item_response_message parse(http_response&& response)
12021 const auto doc = parse_response(std::move(response));
12022 auto elem = get_element_by_qname(*doc,
"SendItemResponseMessage",
12023 uri<>::microsoft::messages());
12025 check(elem,
"Expected <SendItemResponseMessage>");
12026 auto result = parse_response_class_and_code(*elem);
12027 return send_item_response_message(std::move(result));
12031 explicit send_item_response_message(response_result&& res)
12032 : response_message_base(std::move(res))
12037 class delete_folder_response_message final :
public response_message_base
12040 static delete_folder_response_message parse(http_response&& response)
12042 const auto doc = parse_response(std::move(response));
12044 get_element_by_qname(*doc,
"DeleteFolderResponseMessage",
12045 uri<>::microsoft::messages());
12046 auto result = parse_response_class_and_code(*elem);
12047 check(elem,
"Expected <DeleteFolderResponseMessage>");
12048 return delete_folder_response_message(std::move(result));
12052 explicit delete_folder_response_message(response_result&& res)
12053 : response_message_base(std::move(res))
12058 class delete_item_response_message final :
public response_message_base
12061 static delete_item_response_message parse(http_response&& response)
12063 const auto doc = parse_response(std::move(response));
12064 auto elem = get_element_by_qname(*doc,
"DeleteItemResponseMessage",
12065 uri<>::microsoft::messages());
12066 check(elem,
"Expected <DeleteItemResponseMessage>");
12067 auto result = parse_response_class_and_code(*elem);
12068 return delete_item_response_message(std::move(result));
12072 explicit delete_item_response_message(response_result&& res)
12073 : response_message_base(std::move(res))
12078 class delete_attachment_response_message final
12079 :
public response_message_base
12082 static delete_attachment_response_message
12083 parse(http_response&& response)
12085 const auto doc = parse_response(std::move(response));
12087 get_element_by_qname(*doc,
"DeleteAttachmentResponseMessage",
12088 uri<>::microsoft::messages());
12090 check(elem,
"Expected <DeleteAttachmentResponseMessage>");
12091 auto result = parse_response_class_and_code(*elem);
12093 auto root_item_id =
item_id();
12094 auto root_item_id_elem =
12095 elem->first_node_ns(uri<>::microsoft::messages(),
"RootItemId");
12096 if (root_item_id_elem)
12098 auto id_attr = root_item_id_elem->first_attribute(
"RootItemId");
12099 check(id_attr,
"Expected RootItemId attribute");
12100 auto id = std::string(id_attr->value(), id_attr->value_size());
12102 auto change_key_attr =
12103 root_item_id_elem->first_attribute(
"RootItemChangeKey");
12104 check(change_key_attr,
"Expected RootItemChangeKey attribute");
12105 auto change_key = std::string(change_key_attr->value(),
12106 change_key_attr->value_size());
12108 root_item_id =
item_id(std::move(
id), std::move(change_key));
12111 return delete_attachment_response_message(std::move(result),
12112 std::move(root_item_id));
12115 item_id get_root_item_id()
const {
return root_item_id_; }
12118 delete_attachment_response_message(response_result&& res,
12120 : response_message_base(std::move(res)),
12121 root_item_id_(std::move(root_item_id))
12130 :
public internal::response_message_base
12133 #ifndef EWS_DOXYGEN_SHOULD_SKIP_THIS 12138 const std::string& get_sync_state()
const EWS_NOEXCEPT
12140 return sync_state_;
12143 const std::vector<folder>& get_created_folders()
const EWS_NOEXCEPT
12145 return created_folders_;
12148 const std::vector<folder>& get_updated_folders()
const EWS_NOEXCEPT
12150 return updated_folders_;
12153 const std::vector<folder_id>& get_deleted_folder_ids()
const EWS_NOEXCEPT
12155 return deleted_folder_ids_;
12158 bool get_includes_last_folder_in_range()
const EWS_NOEXCEPT
12160 return includes_last_folder_in_range_;
12165 : response_message_base(std::move(res)), sync_state_(),
12166 created_folders_(), updated_folders_(), deleted_folder_ids_(),
12167 includes_last_folder_in_range_(
false)
12171 std::string sync_state_;
12172 std::vector<folder> created_folders_;
12173 std::vector<folder> updated_folders_;
12174 std::vector<folder_id> deleted_folder_ids_;
12175 bool includes_last_folder_in_range_;
12178 #if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 12179 defined(EWS_HAS_CXX17_STATIC_ASSERT) 12181 !std::is_default_constructible<sync_folder_hierarchy_result>::value,
"");
12182 static_assert(std::is_copy_constructible<sync_folder_hierarchy_result>::value);
12183 static_assert(std::is_copy_assignable<sync_folder_hierarchy_result>::value);
12184 static_assert(std::is_move_constructible<sync_folder_hierarchy_result>::value);
12185 static_assert(std::is_move_assignable<sync_folder_hierarchy_result>::value);
12191 #ifndef EWS_DOXYGEN_SHOULD_SKIP_THIS 12196 const std::string& get_sync_state()
const EWS_NOEXCEPT
12198 return sync_state_;
12201 const std::vector<item_id>& get_created_items()
const EWS_NOEXCEPT
12203 return created_items_;
12206 const std::vector<item_id>& get_updated_items()
const EWS_NOEXCEPT
12208 return updated_items_;
12211 const std::vector<item_id>& get_deleted_items()
const EWS_NOEXCEPT
12213 return deleted_items_;
12216 const std::vector<std::pair<item_id, bool>>&
12217 get_read_flag_changed()
const EWS_NOEXCEPT
12219 return read_flag_changed_;
12222 bool get_includes_last_item_in_range()
const EWS_NOEXCEPT
12224 return includes_last_item_in_range_;
12229 : response_message_base(std::move(res)), sync_state_(),
12230 created_items_(), updated_items_(), deleted_items_(),
12231 read_flag_changed_(), includes_last_item_in_range_(
false)
12235 std::string sync_state_;
12236 std::vector<item_id> created_items_;
12237 std::vector<item_id> updated_items_;
12238 std::vector<item_id> deleted_items_;
12239 std::vector<std::pair<item_id, bool>> read_flag_changed_;
12240 bool includes_last_item_in_range_;
12243 #if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 12244 defined(EWS_HAS_CXX17_STATIC_ASSERT) 12245 static_assert(!std::is_default_constructible<sync_folder_items_result>::value,
12247 static_assert(std::is_copy_constructible<sync_folder_items_result>::value);
12248 static_assert(std::is_copy_assignable<sync_folder_items_result>::value);
12249 static_assert(std::is_move_constructible<sync_folder_items_result>::value);
12250 static_assert(std::is_move_assignable<sync_folder_items_result>::value);
12293 #ifdef EWS_HAS_DEFAULT_AND_DELETE 12300 : val_(std::move(str))
12304 const std::string& to_string()
const EWS_NOEXCEPT {
return val_; }
12306 inline bool is_set()
const EWS_NOEXCEPT {
return !val_.empty(); }
12318 throw exception(
"to_epoch called on empty date_time");
12321 bool local_time =
false;
12322 time_t offset = 0U;
12324 int y, M, d, h, m, tzh, tzm;
12328 #if _MSC_VER == 1700 || _MSC_VER == 1800 12329 auto res = sscanf_s(val_.c_str(),
"%d-%d-%dT%d:%d:%f%c%d:%d", &y, &M,
12330 &d, &h, &m, &s, &tzo, 1, &tzh, &tzm);
12332 auto res = sscanf(val_.c_str(),
"%d-%d-%dT%d:%d:%f%c%d:%d", &y, &M, &d,
12333 &h, &m, &s, &tzo, &tzh, &tzm);
12352 throw exception(
"to_epoch: unexpected character at match 7");
12359 offset = (tzh * 60 * 60) + (tzm * 60);
12361 else if (tzo ==
'+')
12363 offset = ((tzh * 60 * 60) + (tzm * 60)) * (-1);
12367 throw exception(
"to_epoch: unexpected character at match 7");
12372 throw exception(
"to_epoch: could not parse string");
12377 memset(&t, 0,
sizeof(
struct tm));
12378 t.tm_year = y - 1900;
12383 t.tm_sec =
static_cast<int>(s);
12390 epoch = mktime(&t);
12394 "mktime: time cannot be represented as calendar time");
12402 epoch = _mkgmtime(&t);
12404 epoch = timegm(&t);
12409 "timegm: time cannot be represented as calendar time");
12413 local_time ? 0L : (offset == 0L ? utc_offset(&epoch) : offset);
12414 return epoch + bias;
12431 gmtime_s(&result, &epoch);
12435 auto t = gmtime_r(&epoch, &result);
12438 auto len = strftime(buf,
sizeof buf,
"%Y-%m-%dT%H:%M:%SZ", t);
12451 static time_t utc_offset(
const time_t* timepoint)
12454 if (timepoint ==
nullptr)
12456 now = time(
nullptr);
12465 auto gmtime_error = gmtime_s(&gmtime_result, &now);
12468 throw std::runtime_error(
"Invalid argument to gmtime_s");
12470 tm* utc_time = &gmtime_result;
12473 auto utc_time = gmtime_r(&now, &result);
12475 utc_time->tm_isdst = -1;
12476 const auto utc_epoch = mktime(utc_time);
12479 tm localtime_result;
12480 auto localtime_error = localtime_s(&localtime_result, &now);
12481 if (localtime_error)
12483 throw std::runtime_error(
"Invalid argument to localtime_s");
12485 tm* local_time = &localtime_result;
12487 auto local_time = localtime_r(&now, &result);
12489 local_time->tm_isdst = -1;
12490 const auto local_epoch = mktime(local_time);
12492 return local_epoch - utc_epoch;
12501 return lhs.val_ == rhs.val_;
12504 #if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 12505 defined(EWS_HAS_CXX17_STATIC_ASSERT) 12506 static_assert(std::is_default_constructible<date_time>::value);
12507 static_assert(std::is_copy_constructible<date_time>::value);
12508 static_assert(std::is_copy_assignable<date_time>::value);
12509 static_assert(std::is_move_constructible<date_time>::value);
12510 static_assert(std::is_move_assignable<date_time>::value);
12538 #ifdef EWS_HAS_DEFAULT_AND_DELETE 12545 : val_(std::move(str))
12549 const std::string& to_string()
const EWS_NOEXCEPT {
return val_; }
12551 inline bool is_set()
const EWS_NOEXCEPT {
return !val_.empty(); }
12560 return lhs.val_ == rhs.val_;
12563 #if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 12564 defined(EWS_HAS_CXX17_STATIC_ASSERT) 12565 static_assert(std::is_default_constructible<duration>::value);
12566 static_assert(std::is_copy_constructible<duration>::value);
12567 static_assert(std::is_copy_assignable<duration>::value);
12568 static_assert(std::is_move_constructible<duration>::value);
12569 static_assert(std::is_move_assignable<duration>::value);
12592 inline std::string body_type_str(
body_type type)
12619 : content_(std::move(content)), type_(type), is_truncated_(false)
12623 body_type type()
const EWS_NOEXCEPT {
return type_; }
12625 void set_type(
body_type type) { type_ = type; }
12627 bool is_truncated()
const EWS_NOEXCEPT {
return is_truncated_; }
12629 void set_truncated(
bool truncated) { is_truncated_ = truncated; }
12631 const std::string& content()
const EWS_NOEXCEPT {
return content_; }
12633 void set_content(std::string content) { content_ = std::move(content); }
12635 std::string to_xml()
const 12638 static const auto cdata_beg = std::string(
"<![CDATA[");
12639 static const auto cdata_end = std::string(
"]]>");
12641 std::stringstream sstr;
12642 sstr <<
"<t:Body BodyType=\"" << internal::body_type_str(type());
12645 !(content_.compare(0, cdata_beg.length(), cdata_beg) == 0))
12647 sstr << cdata_beg << content_ << cdata_end;
12651 sstr << internal::escape(content_);
12653 sstr <<
"</t:Body>";
12658 std::string content_;
12660 bool is_truncated_;
12663 #if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 12664 defined(EWS_HAS_CXX17_STATIC_ASSERT) 12665 static_assert(std::is_default_constructible<body>::value);
12666 static_assert(std::is_copy_constructible<body>::value);
12667 static_assert(std::is_copy_assignable<body>::value);
12668 static_assert(std::is_move_constructible<body>::value);
12669 static_assert(std::is_move_assignable<body>::value);
12680 #ifdef EWS_HAS_DEFAULT_AND_DELETE 12688 : charset_(std::move(charset)), bytearray_(ptr, ptr + len)
12696 const char*
bytes() const EWS_NOEXCEPT {
return bytearray_.data(); }
12698 size_t len_bytes()
const EWS_NOEXCEPT {
return bytearray_.size(); }
12705 bool none() const EWS_NOEXCEPT {
return len_bytes() == 0U; }
12708 std::string charset_;
12709 std::vector<char> bytearray_;
12712 #if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 12713 defined(EWS_HAS_CXX17_STATIC_ASSERT) 12714 static_assert(std::is_default_constructible<mime_content>::value);
12715 static_assert(std::is_copy_constructible<mime_content>::value);
12716 static_assert(std::is_copy_assignable<mime_content>::value);
12717 static_assert(std::is_move_constructible<mime_content>::value);
12718 static_assert(std::is_move_assignable<mime_content>::value);
12731 : mailbox_(std::move(address)), response_type_(std::move(type)),
12732 last_response_time_(std::move(last_response_time))
12738 last_response_time_()
12751 return response_type_;
12760 return last_response_time_;
12766 last_response_time_ = time;
12772 return proposed_start_;
12781 return proposed_end_;
12790 std::stringstream sstr;
12791 sstr <<
"<t:Attendee>";
12792 sstr << mailbox_.to_xml();
12793 sstr <<
"<t:ResponseType>" << internal::enum_to_str(response_type_)
12794 <<
"</t:ResponseType>";
12795 sstr <<
"<t:LastResponseTime>" << last_response_time_.to_string()
12796 <<
"</t:LastResponseTime>";
12797 if (!proposed_start_.to_string().empty())
12799 sstr <<
"<t:ProposedStart>" << proposed_start_.to_string()
12800 <<
"</t:ProposedStart>";
12802 if (!proposed_end_.to_string().empty())
12804 sstr <<
"<t:ProposedEnd>" << proposed_end_.to_string()
12805 <<
"</t:ProposedEnd>";
12807 sstr <<
"</t:Attendee>";
12817 check(parent.document(),
12818 "Parent node needs to be somewhere in a document");
12828 using namespace internal;
12830 auto& attendee_node = create_node(parent,
"t:Attendee");
12831 mailbox_.to_xml_element(attendee_node);
12833 create_node(attendee_node,
"t:ResponseType",
12834 enum_to_str(response_type_));
12835 create_node(attendee_node,
"t:LastResponseTime",
12836 last_response_time_.to_string());
12838 if (!proposed_start_.to_string().empty())
12840 create_node(attendee_node,
"t:ProposedStart",
12841 proposed_start_.to_string());
12843 if (!proposed_end_.to_string().empty())
12845 create_node(attendee_node,
"t:ProposedEnd",
12846 proposed_end_.to_string());
12849 return attendee_node;
12855 using rapidxml::internal::compare;
12865 auto mailbox_node =
12866 elem.first_node_ns(internal::uri<>::microsoft::types(),
"Mailbox");
12867 check(mailbox_node,
"Expected <Mailbox>");
12871 for (
auto node = elem.first_node(); node; node = node->next_sibling())
12873 if (compare(node->local_name(), node->local_name_size(),
12874 "ResponseType", strlen(
"ResponseType")))
12877 std::string(node->value(), node->value_size())));
12879 else if (compare(node->local_name(), node->local_name_size(),
12880 "LastResponseTime", strlen(
"LastResponseTime")))
12883 date_time(std::string(node->value(), node->value_size())));
12885 else if (compare(node->local_name(), node->local_name_size(),
12886 "ProposedStart", strlen(
"ProposedStart")))
12889 date_time(std::string(node->value(), node->value_size())));
12891 else if (compare(node->local_name(), node->local_name_size(),
12892 "ProposedEnd", strlen(
"ProposedEnd")))
12895 date_time(std::string(node->value(), node->value_size())));
12910 #if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 12911 defined(EWS_HAS_CXX17_STATIC_ASSERT) 12912 static_assert(!std::is_default_constructible<attendee>::value);
12913 static_assert(std::is_copy_constructible<attendee>::value);
12914 static_assert(std::is_copy_assignable<attendee>::value);
12915 static_assert(std::is_move_constructible<attendee>::value);
12916 static_assert(std::is_move_assignable<attendee>::value);
12934 #ifdef EWS_HAS_DEFAULT_AND_DELETE 12944 : header_name_(std::move(name)), header_value_(std::move(value))
12949 const std::string&
get_name() const EWS_NOEXCEPT {
return header_name_; }
12952 const std::string&
get_value() const EWS_NOEXCEPT {
return header_value_; }
12955 std::string header_name_;
12956 std::string header_value_;
12959 #if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 12960 defined(EWS_HAS_CXX17_STATIC_ASSERT) 12961 static_assert(!std::is_default_constructible<internet_message_header>::value);
12962 static_assert(std::is_copy_constructible<internet_message_header>::value);
12963 static_assert(std::is_copy_assignable<internet_message_header>::value);
12964 static_assert(std::is_move_constructible<internet_message_header>::value);
12965 static_assert(std::is_move_assignable<internet_message_header>::value);
12971 template <
int tag>
class str_wrapper final
12974 #ifdef EWS_HAS_DEFAULT_AND_DELETE 12975 str_wrapper() =
default;
12977 str_wrapper() : value_() {}
12980 explicit str_wrapper(std::string str) : value_(std::move(str)) {}
12982 const std::string& str()
const EWS_NOEXCEPT {
return value_; }
12985 std::string value_;
12988 #if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 12989 defined(EWS_HAS_CXX17_STATIC_ASSERT) 12990 static_assert(std::is_default_constructible<str_wrapper<0>>::value);
12991 static_assert(std::is_copy_constructible<str_wrapper<0>>::value);
12992 static_assert(std::is_copy_assignable<str_wrapper<0>>::value);
12993 static_assert(std::is_move_constructible<str_wrapper<0>>::value);
12994 static_assert(std::is_move_assignable<str_wrapper<0>>::value);
12999 distinguished_property_set_id,
13012 #ifndef EWS_DOXYGEN_SHOULD_SKIP_THIS 13013 # ifdef EWS_HAS_TYPE_ALIAS 13014 using distinguished_property_set_id =
13015 internal::str_wrapper<internal::distinguished_property_set_id>;
13016 using property_set_id = internal::str_wrapper<internal::property_set_id>;
13017 using property_tag = internal::str_wrapper<internal::property_tag>;
13018 using property_name = internal::str_wrapper<internal::property_name>;
13019 using property_id = internal::str_wrapper<internal::property_id>;
13020 using property_type = internal::str_wrapper<internal::property_type>;
13022 typedef internal::str_wrapper<internal::distinguished_property_set_id>
13023 distinguished_property_set_id;
13024 typedef internal::str_wrapper<internal::property_set_id> property_set_id;
13025 typedef internal::str_wrapper<internal::property_tag> property_tag;
13026 typedef internal::str_wrapper<internal::property_name> property_name;
13027 typedef internal::str_wrapper<internal::property_id> property_id;
13028 typedef internal::str_wrapper<internal::property_type> property_type;
13032 #ifdef EWS_HAS_DEFAULT_AND_DELETE 13042 property_type type)
13043 : distinguished_set_id_(std::move(set_id)), id_(std::move(
id)),
13044 type_(std::move(type))
13049 property_type type)
13050 : distinguished_set_id_(std::move(set_id)), name_(std::move(name)),
13051 type_(std::move(type))
13056 property_type type)
13057 : set_id_(std::move(set_id)), id_(std::move(
id)), type_(std::move(type))
13062 property_type type)
13063 : set_id_(std::move(set_id)), name_(std::move(name)),
13064 type_(std::move(type))
13069 : tag_(std::move(tag)), type_(std::move(type))
13073 const std::string& get_distinguished_property_set_id()
const EWS_NOEXCEPT
13075 return distinguished_set_id_.str();
13078 const std::string& get_property_set_id()
const EWS_NOEXCEPT
13080 return set_id_.str();
13083 const std::string& get_property_tag()
const EWS_NOEXCEPT
13088 const std::string& get_property_name()
const EWS_NOEXCEPT
13090 return name_.str();
13093 const std::string& get_property_id()
const EWS_NOEXCEPT
13098 const std::string& get_property_type()
const EWS_NOEXCEPT
13100 return type_.str();
13106 std::stringstream sstr;
13108 sstr <<
"<t:ExtendedFieldURI ";
13110 if (!distinguished_set_id_.str().empty())
13112 sstr <<
"DistinguishedPropertySetId=\"" 13113 << distinguished_set_id_.str() <<
"\" ";
13115 if (!id_.str().empty())
13117 sstr <<
"PropertyId=\"" << id_.str() <<
"\" ";
13119 if (!set_id_.str().empty())
13121 sstr <<
"PropertySetId=\"" << set_id_.str() <<
"\" ";
13123 if (!tag_.str().empty())
13125 sstr <<
"PropertyTag=\"" << tag_.str() <<
"\" ";
13127 if (!name_.str().empty())
13129 sstr <<
"PropertyName=\"" << name_.str() <<
"\" ";
13131 if (!type_.str().empty())
13133 sstr <<
"PropertyType=\"" << type_.str() <<
"\"/>";
13141 using rapidxml::internal::compare;
13143 check(compare(elem.name(), elem.name_size(),
"t:ExtendedFieldURI",
13144 strlen(
"t:ExtendedFieldURI")),
13145 "Expected a <ExtendedFieldURI>, got something else");
13147 std::string distinguished_set_id;
13148 std::string set_id;
13154 for (
auto attr = elem.first_attribute(); attr !=
nullptr;
13155 attr = attr->next_attribute())
13157 if (compare(attr->name(), attr->name_size(),
13158 "DistinguishedPropertySetId",
13159 strlen(
"DistinguishedPropertySetId")))
13161 distinguished_set_id =
13162 std::string(attr->value(), attr->value_size());
13164 else if (compare(attr->name(), attr->name_size(),
"PropertySetId",
13165 strlen(
"PropertySetId")))
13167 set_id = std::string(attr->value(), attr->value_size());
13169 else if (compare(attr->name(), attr->name_size(),
"PropertyTag",
13170 strlen(
"PropertyTag")))
13172 tag = std::string(attr->value(), attr->value_size());
13174 else if (compare(attr->name(), attr->name_size(),
"PropertyName",
13175 strlen(
"PropertyName")))
13177 name = std::string(attr->value(), attr->value_size());
13179 else if (compare(attr->name(), attr->name_size(),
"PropertyId",
13180 strlen(
"PropertyId")))
13182 id = std::string(attr->value(), attr->value_size());
13184 else if (compare(attr->name(), attr->name_size(),
"PropertyType",
13185 strlen(
"PropertyType")))
13187 type = std::string(attr->value(), attr->value_size());
13191 throw exception(
"Unexpected attribute in <ExtendedFieldURI>");
13195 check(!type.empty(),
"'PropertyType' attribute missing");
13197 if (!distinguished_set_id.empty())
13202 distinguished_property_set_id(distinguished_set_id),
13203 property_id(
id), property_type(type));
13205 else if (!name.empty())
13208 distinguished_property_set_id(distinguished_set_id),
13209 property_name(name), property_type(type));
13212 else if (!set_id.empty())
13217 property_id(
id), property_type(type));
13219 else if (!name.empty())
13222 property_name(name),
13223 property_type(type));
13226 else if (!tag.empty())
13232 "Unexpected combination of <ExtendedFieldURI/> attributes");
13235 rapidxml::xml_node<>& to_xml_element(rapidxml::xml_node<>& parent)
const 13237 auto doc = parent.document();
13239 auto ptr_to_node = doc->allocate_string(
"t:ExtendedFieldURI");
13240 auto new_node = doc->allocate_node(rapidxml::node_element, ptr_to_node);
13241 new_node->namespace_uri(internal::uri<>::microsoft::types(),
13242 internal::uri<>::microsoft::types_size);
13244 if (!get_distinguished_property_set_id().empty())
13247 doc->allocate_string(
"DistinguishedPropertySetId");
13248 auto ptr_to_property = doc->allocate_string(
13249 get_distinguished_property_set_id().c_str());
13251 doc->allocate_attribute(ptr_to_attr, ptr_to_property);
13252 new_node->append_attribute(attr_new);
13255 if (!get_property_set_id().empty())
13257 auto ptr_to_attr = doc->allocate_string(
"PropertySetId");
13258 auto ptr_to_property =
13259 doc->allocate_string(get_property_set_id().c_str());
13261 doc->allocate_attribute(ptr_to_attr, ptr_to_property);
13262 new_node->append_attribute(attr_new);
13265 if (!get_property_tag().empty())
13267 auto ptr_to_attr = doc->allocate_string(
"PropertyTag");
13268 auto ptr_to_property =
13269 doc->allocate_string(get_property_tag().c_str());
13271 doc->allocate_attribute(ptr_to_attr, ptr_to_property);
13272 new_node->append_attribute(attr_new);
13275 if (!get_property_name().empty())
13277 auto ptr_to_attr = doc->allocate_string(
"PropertyName");
13278 auto ptr_to_property =
13279 doc->allocate_string(get_property_name().c_str());
13281 doc->allocate_attribute(ptr_to_attr, ptr_to_property);
13282 new_node->append_attribute(attr_new);
13285 if (!get_property_type().empty())
13287 auto ptr_to_attr = doc->allocate_string(
"PropertyType");
13288 auto ptr_to_property =
13289 doc->allocate_string(get_property_type().c_str());
13291 doc->allocate_attribute(ptr_to_attr, ptr_to_property);
13292 new_node->append_attribute(attr_new);
13295 if (!get_property_id().empty())
13297 auto ptr_to_attr = doc->allocate_string(
"PropertyId");
13298 auto ptr_to_property =
13299 doc->allocate_string(get_property_id().c_str());
13301 doc->allocate_attribute(ptr_to_attr, ptr_to_property);
13302 new_node->append_attribute(attr_new);
13305 parent.append_node(new_node);
13310 distinguished_property_set_id distinguished_set_id_;
13311 property_set_id set_id_;
13313 property_name name_;
13315 property_type type_;
13318 #if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 13319 defined(EWS_HAS_CXX17_STATIC_ASSERT) 13320 static_assert(!std::is_default_constructible<extended_field_uri>::value);
13321 static_assert(std::is_copy_constructible<extended_field_uri>::value);
13322 static_assert(std::is_copy_assignable<extended_field_uri>::value);
13323 static_assert(std::is_move_constructible<extended_field_uri>::value);
13324 static_assert(std::is_move_assignable<extended_field_uri>::value);
13337 #ifdef EWS_HAS_DEFAULT_AND_DELETE 13349 std::vector<std::string> values)
13350 : extended_field_uri_(std::move(ext_field_uri)),
13351 values_(std::move(values))
13356 from_xml_element(
const rapidxml::xml_node<char>& node);
13357 std::string to_xml()
const;
13363 return extended_field_uri_;
13375 std::vector<std::string> values_;
13378 #if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 13379 defined(EWS_HAS_CXX17_STATIC_ASSERT) 13380 static_assert(!std::is_default_constructible<extended_property>::value);
13381 static_assert(std::is_copy_constructible<extended_property>::value);
13382 static_assert(std::is_copy_assignable<extended_property>::value);
13383 static_assert(std::is_move_constructible<extended_property>::value);
13384 static_assert(std::is_move_assignable<extended_property>::value);
13387 inline std::string extended_property::to_xml()
const 13389 std::stringstream sstr;
13391 auto values = get_values();
13392 auto efu = get_extended_field_uri();
13393 for (
auto&& v : values)
13395 sstr << efu.to_xml();
13396 sstr <<
"<t:Message>";
13397 sstr <<
"<t:ExtendedProperty>" << efu.to_xml();
13398 sstr <<
"<t:Value>" << v <<
"</t:Value>";
13399 sstr <<
"</t:ExtendedProperty>";
13400 sstr <<
"</t:Message>";
13406 extended_property::from_xml_element(
const rapidxml::xml_node<char>& top_node)
13408 using namespace internal;
13409 using rapidxml::internal::compare;
13411 check(compare(top_node.name(), top_node.name_size(),
"t:ExtendedProperty",
13412 strlen(
"t:ExtendedProperty")),
13413 "Expected a <ExtendedProperty>, got something else");
13415 auto node = top_node.first_node();
13417 std::vector<std::string> values;
13418 node = node->next_sibling();
13420 if (compare(node->name(), node->name_size(),
"t:Value", strlen(
"t:Value")))
13422 values.emplace_back(std::string(node->value(), node->value_size()));
13424 else if (compare(node->name(), node->name_size(),
"t:Values",
13425 strlen(
"t:Values")))
13427 for (
auto child = node->first_node(); child !=
nullptr;
13428 child = child->next_sibling())
13430 values.emplace_back(
13431 std::string(child->value(), child->value_size()));
13442 #ifdef EWS_HAS_DEFAULT_AND_DELETE 13447 explicit folder(
folder_id id) : folder_id_(std::move(
id)), xml_subtree_() {}
13450 #ifndef EWS_DOXYGEN_SHOULD_SKIP_THIS 13452 : folder_id_(std::move(
id)), xml_subtree_(std::move(properties))
13463 return xml().get_value_as_string(
"DisplayName");
13469 xml().set_or_update(
"DisplayName", display_name);
13475 return std::stoi(xml().get_value_as_string(
"TotalCount"));
13481 return std::stoi(xml().get_value_as_string(
"ChildFolderCount"));
13487 auto parent_id_node = xml().get_node(
"ParentFolderId");
13488 check(parent_id_node,
"Expected <ParentFolderId>");
13495 return std::stoi(xml().get_value_as_string(
"UnreadCount"));
13502 elem.first_node_ns(internal::uri<>::microsoft::types(),
"FolderId");
13503 check(id_node,
"Expected <FolderId>");
13505 internal::xml_subtree(elem));
13508 #ifndef EWS_DOXYGEN_SHOULD_SKIP_THIS 13510 internal::xml_subtree& xml() EWS_NOEXCEPT {
return xml_subtree_; }
13512 const internal::xml_subtree& xml()
const EWS_NOEXCEPT
13514 return xml_subtree_;
13522 internal::xml_subtree xml_subtree_;
13525 #if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 13526 defined(EWS_HAS_CXX17_STATIC_ASSERT) 13527 static_assert(std::is_default_constructible<folder>::value);
13528 static_assert(std::is_copy_constructible<folder>::value);
13529 static_assert(std::is_copy_assignable<folder>::value);
13530 static_assert(std::is_move_constructible<folder>::value);
13531 static_assert(std::is_move_assignable<folder>::value);
13554 #ifdef EWS_HAS_DEFAULT_AND_DELETE 13559 explicit item(
item_id id) : item_id_(std::move(
id)), xml_subtree_() {}
13562 #ifndef EWS_DOXYGEN_SHOULD_SKIP_THIS 13563 item(
item_id&&
id, internal::xml_subtree&& properties)
13564 : item_id_(std::move(
id)), xml_subtree_(std::move(properties))
13575 const auto node = xml().get_node(
"MimeContent");
13580 auto charset = node->first_attribute(
"CharacterSet");
13581 check(charset,
"Expected <MimeContent> to have CharacterSet attribute");
13583 node->value_size());
13592 const auto node = xml().get_node(
"ParentFolderId");
13600 return xml().get_value_as_string(
"ItemClass");
13606 xml().set_or_update(
"Subject", subject);
13612 return xml().get_value_as_string(
"Subject");
13618 const auto val = xml().get_value_as_string(
"Sensitivity");
13619 return !val.empty() ? internal::str_to_sensitivity(val)
13626 xml().set_or_update(
"Sensitivity", internal::enum_to_str(s));
13632 auto doc = xml().document();
13634 auto body_node = xml().get_node(
"Body");
13637 doc->remove_node(body_node);
13640 body_node = &internal::create_node(*doc,
"t:Body", b.content());
13642 auto ptr_to_key = doc->allocate_string(
"BodyType");
13643 auto ptr_to_value =
13644 doc->allocate_string(internal::body_type_str(b.type()).c_str());
13645 body_node->append_attribute(
13646 doc->allocate_attribute(ptr_to_key, ptr_to_value));
13648 bool truncated = b.is_truncated();
13651 ptr_to_key = doc->allocate_string(
"IsTruncated");
13652 ptr_to_value = doc->allocate_string(truncated ?
"true" :
"false");
13653 body_node->append_attribute(
13654 doc->allocate_attribute(ptr_to_key, ptr_to_value));
13661 using rapidxml::internal::compare;
13664 auto body_node = xml().get_node(
"Body");
13667 for (
auto attr = body_node->first_attribute(); attr;
13668 attr = attr->next_attribute())
13670 if (compare(attr->name(), attr->name_size(),
"BodyType",
13671 strlen(
"BodyType")))
13673 if (compare(attr->value(), attr->value_size(),
"HTML",
13678 else if (compare(attr->value(), attr->value_size(),
"Text",
13683 else if (compare(attr->value(), attr->value_size(),
"Best",
13690 check(
false,
"Unexpected attribute value for BodyType");
13693 else if (compare(attr->name(), attr->name_size(),
"IsTruncated",
13694 strlen(
"IsTruncated")))
13696 const auto val = compare(attr->value(), attr->value_size(),
13697 "true", strlen(
"true"));
13698 b.set_truncated(val);
13702 check(
false,
"Unexpected attribute in <Body> element");
13707 std::string(body_node->value(), body_node->value_size());
13708 b.set_content(std::move(content));
13718 const auto attachments_node = xml().get_node(
"Attachments");
13719 if (!attachments_node)
13721 return std::vector<attachment>();
13724 std::vector<attachment> attachments;
13725 for (
auto child = attachments_node->first_node(); child !=
nullptr;
13726 child = child->next_sibling())
13730 return attachments;
13738 const auto val = xml().get_value_as_string(
"DateTimeReceived");
13747 const auto size = xml().get_value_as_string(
"Size");
13748 return size.empty() ? 0U : std::stoul(size);
13760 auto doc = xml().document();
13761 auto target_node = xml().get_node(
"Categories");
13764 target_node = &internal::create_node(*doc,
"t:Categories");
13767 for (
const auto& category : categories)
13769 internal::create_node(*target_node,
"t:String", category);
13778 const auto categories_node = xml().get_node(
"Categories");
13779 if (!categories_node)
13781 return std::vector<std::string>();
13784 std::vector<std::string> categories;
13785 for (
auto child = categories_node->first_node(); child !=
nullptr;
13786 child = child->next_sibling())
13788 categories.emplace_back(
13789 std::string(child->value(), child->value_size()));
13797 xml().set_or_update(
"Importance", internal::enum_to_str(i));
13803 const auto val = xml().get_value_as_string(
"Importance");
13804 return !val.empty() ? internal::str_to_importance(val)
13814 return xml().get_value_as_string(
"InReplyTo");
13822 return xml().get_value_as_string(
"isSubmitted") ==
"true";
13830 return xml().get_value_as_string(
"isDraft") ==
"true";
13838 return xml().get_value_as_string(
"isFromMe") ==
"true";
13846 return xml().get_value_as_string(
"isResend") ==
"true";
13854 return xml().get_value_as_string(
"isUnmodified") ==
"true";
13865 const auto node = xml().get_node(
"InternetMessageHeaders");
13868 return std::vector<internet_message_header>();
13871 std::vector<internet_message_header> headers;
13872 for (
auto child = node->first_node(); child !=
nullptr;
13873 child = child->next_sibling())
13875 auto field = std::string(child->first_attribute()->value(),
13876 child->first_attribute()->value_size());
13877 auto value = std::string(child->value(), child->value_size());
13879 headers.emplace_back(
13891 return date_time(xml().get_value_as_string(
"DateTimeSent"));
13899 return date_time(xml().get_value_as_string(
"DateTimeCreated"));
13911 xml().set_or_update(
"ReminderDueBy", due_by.to_string());
13919 return date_time(xml().get_value_as_string(
"ReminderDueBy"));
13925 xml().set_or_update(
"ReminderIsSet", enabled ?
"true" :
"false");
13931 return xml().get_value_as_string(
"ReminderIsSet") ==
"true";
13938 xml().set_or_update(
"ReminderMinutesBeforeStart",
13939 std::to_string(minutes));
13946 std::string minutes =
13947 xml().get_value_as_string(
"ReminderMinutesBeforeStart");
13948 return minutes.empty() ? 0U : std::stoul(minutes);
13959 return xml().get_value_as_string(
"DisplayCc");
13970 return xml().get_value_as_string(
"DisplayTo");
13978 return xml().get_value_as_string(
"HasAttachments") ==
"true";
13985 using rapidxml::internal::compare;
13987 std::vector<extended_property> properties;
13989 for (
auto top_node = xml().get_node(
"ExtendedProperty");
13990 top_node !=
nullptr; top_node = top_node->next_sibling())
13992 if (!compare(top_node->name(), top_node->name_size(),
13993 "t:ExtendedProperty", strlen(
"t:ExtendedProperty")))
13998 auto ext_prop = extended_property::from_xml_element(*top_node);
13999 properties.emplace_back(ext_prop);
14008 auto doc = xml().document();
14010 auto ptr_to_qname = doc->allocate_string(
"t:ExtendedProperty");
14011 auto top_node = doc->allocate_node(rapidxml::node_element);
14012 top_node->qname(ptr_to_qname, strlen(
"t:ExtendedProperty"),
14014 top_node->namespace_uri(internal::uri<>::microsoft::types(),
14015 internal::uri<>::microsoft::types_size);
14016 doc->append_node(top_node);
14019 field_uri.to_xml_element(*top_node);
14021 rapidxml::xml_node<>* cover_node =
nullptr;
14024 auto ptr_to_values = doc->allocate_string(
"t:Values");
14026 doc->allocate_node(rapidxml::node_element, ptr_to_values);
14027 cover_node->namespace_uri(internal::uri<>::microsoft::types(),
14028 internal::uri<>::microsoft::types_size);
14029 top_node->append_node(cover_node);
14034 auto new_str = doc->allocate_string(str.c_str());
14035 auto ptr_to_value = doc->allocate_string(
"t:Value");
14037 doc->allocate_node(rapidxml::node_element, ptr_to_value);
14038 cur_node->namespace_uri(internal::uri<>::microsoft::types(),
14039 internal::uri<>::microsoft::types_size);
14040 cur_node->value(new_str);
14042 cover_node ==
nullptr ? top_node->append_node(cur_node)
14043 : cover_node->append_node(cur_node);
14050 xml().set_or_update(
"Culture", culture);
14056 return xml().get_value_as_string(
"Culture");
14069 #ifndef EWS_DOXYGEN_SHOULD_SKIP_THIS 14071 internal::xml_subtree& xml() EWS_NOEXCEPT {
return xml_subtree_; }
14073 const internal::xml_subtree& xml()
const EWS_NOEXCEPT
14075 return xml_subtree_;
14079 void set_array_of_strings_helper(
const std::vector<std::string>& strings,
14084 using namespace internal;
14086 auto outer_node = xml().get_node(name);
14089 auto doc = outer_node->document();
14090 doc->remove_node(outer_node);
14093 if (strings.empty())
14099 outer_node = &create_node(*xml().document(), std::string(
"t:") + name);
14100 for (
const auto& element : strings)
14102 create_node(*outer_node,
"t:String", element);
14106 std::vector<std::string> get_array_of_strings_helper(
const char* name)
const 14108 auto node = xml().get_node(name);
14111 return std::vector<std::string>();
14113 auto res = std::vector<std::string>();
14114 for (
auto entry = node->first_node(); entry;
14115 entry = entry->next_sibling())
14117 res.emplace_back(std::string(entry->value(), entry->value_size()));
14126 internal::xml_subtree xml_subtree_;
14129 #if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 14130 defined(EWS_HAS_CXX17_STATIC_ASSERT) 14131 static_assert(std::is_default_constructible<item>::value);
14132 static_assert(std::is_copy_constructible<item>::value);
14133 static_assert(std::is_copy_assignable<item>::value);
14134 static_assert(std::is_move_constructible<item>::value);
14135 static_assert(std::is_move_assignable<item>::value);
14142 enum class distinguished_user
14144 default_user_account,
14148 #ifdef EWS_HAS_DEFAULT_AND_DELETE 14154 user_id(std::string sid, std::string primary_smtp_address,
14155 std::string display_name)
14156 : sid_(std::move(sid)),
14157 primary_smtp_address_(std::move(primary_smtp_address)),
14158 display_name_(std::move(display_name)), distinguished_user_(),
14159 external_user_identity_(
false)
14163 user_id(std::string sid, std::string primary_smtp_address,
14164 std::string display_name, distinguished_user user_account,
14165 bool external_user_identity)
14166 : sid_(std::move(sid)),
14167 primary_smtp_address_(std::move(primary_smtp_address)),
14168 display_name_(std::move(display_name)),
14169 distinguished_user_(std::move(user_account)),
14170 external_user_identity_(std::move(external_user_identity))
14174 const std::string& get_sid()
const EWS_NOEXCEPT {
return sid_; }
14176 const std::string& get_primary_smtp_address()
const EWS_NOEXCEPT
14178 return primary_smtp_address_;
14181 const std::string& get_display_name()
const EWS_NOEXCEPT
14183 return display_name_;
14186 #ifdef EWS_HAS_OPTIONAL 14187 std::optional<distinguished_user>
14189 internal::optional<distinguished_user>
14191 get_distinguished_user()
const EWS_NOEXCEPT
14193 return distinguished_user_;
14196 bool is_external_user_identity()
const EWS_NOEXCEPT
14198 return external_user_identity_;
14204 return user_id(std::string(), std::move(primary_smtp_address),
14211 return user_id(std::move(sid), std::string(), std::string());
14214 static user_id from_xml_element(
const rapidxml::xml_node<char>& elem)
14216 using rapidxml::internal::compare;
14227 std::string primary_smtp_address;
14228 std::string display_name;
14229 distinguished_user user_account =
14230 distinguished_user::default_user_account;
14231 bool external_user_identity =
false;
14233 for (
auto node = elem.first_node(); node; node = node->next_sibling())
14235 if (compare(node->local_name(), node->local_name_size(),
"SID",
14238 sid = std::string(node->value(), node->value_size());
14240 else if (compare(node->local_name(), node->local_name_size(),
14241 "PrimarySmtpAddress",
14242 strlen(
"PrimarySmtpAddress")))
14244 primary_smtp_address =
14245 std::string(node->value(), node->value_size());
14247 else if (compare(node->local_name(), node->local_name_size(),
14248 "DisplayName", strlen(
"DisplayName")))
14250 display_name = std::string(node->value(), node->value_size());
14252 else if (compare(node->local_name(), node->local_name_size(),
14253 "DistinguishedUser", strlen(
"DistinguishedUser")))
14255 const auto val = std::string(node->value(), node->value_size());
14256 if (val !=
"Anonymous")
14258 user_account = distinguished_user::anonymous;
14261 else if (compare(node->local_name(), node->local_name_size(),
14262 "ExternalUserIdentity",
14263 strlen(
"ExternalUserIdentity")))
14265 external_user_identity =
true;
14269 throw exception(
"Unexpected child element in <UserId>");
14273 return user_id(sid, primary_smtp_address, display_name, user_account,
14274 external_user_identity);
14277 std::string to_xml()
const 14279 std::stringstream sstr;
14280 sstr <<
"<t:UserId>";
14284 sstr <<
"<t:SID>" << sid_ <<
"</t:SID>";
14287 if (!primary_smtp_address_.empty())
14289 sstr <<
"<t:PrimarySmtpAddress>" << primary_smtp_address_
14290 <<
"</t:PrimarySmtpAddress>";
14293 if (!display_name_.empty())
14295 sstr <<
"<t:DisplayName>" << display_name_ <<
"</t:DisplayName>";
14298 if (distinguished_user_.has_value())
14300 sstr <<
"<t:DistinguishedUser>" 14301 << (distinguished_user_ == distinguished_user::anonymous
14304 <<
"</t:DistinguishedUser>";
14307 if (external_user_identity_)
14309 sstr <<
"<t:ExternalUserIdentity/>";
14312 sstr <<
"</t:UserId>";
14318 std::string primary_smtp_address_;
14319 std::string display_name_;
14320 #ifdef EWS_HAS_OPTIONAL 14321 std::optional<distinguished_user> distinguished_user_;
14323 internal::optional<distinguished_user> distinguished_user_;
14325 bool external_user_identity_;
14329 #if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 14330 defined(EWS_HAS_CXX17_STATIC_ASSERT) 14331 static_assert(std::is_default_constructible<user_id>::value);
14332 static_assert(std::is_copy_constructible<user_id>::value);
14333 static_assert(std::is_copy_assignable<user_id>::value);
14334 static_assert(std::is_move_constructible<user_id>::value);
14335 static_assert(std::is_move_assignable<user_id>::value);
14371 : calendar_folder(permission_level::none),
14372 tasks_folder(permission_level::none),
14373 inbox_folder(permission_level::none),
14374 contacts_folder(permission_level::none),
14375 notes_folder(permission_level::none),
14376 journal_folder(permission_level::none)
14381 std::string to_xml()
const;
14385 from_xml_element(
const rapidxml::xml_node<char>& elem);
14388 #ifdef EWS_HAS_DEFAULT_AND_DELETE 14395 bool receive_copies,
bool view_private_items)
14396 : user_id_(std::move(user)), permissions_(std::move(permissions)),
14397 receive_copies_(std::move(receive_copies)),
14398 view_private_items_(std::move(view_private_items))
14402 const user_id& get_user_id()
const EWS_NOEXCEPT {
return user_id_; }
14406 return permissions_;
14413 return receive_copies_;
14420 return view_private_items_;
14423 static delegate_user from_xml_element(
const rapidxml::xml_node<char>& elem)
14432 using rapidxml::internal::compare;
14436 bool receive_copies =
false;
14437 bool view_private_items =
false;
14439 for (
auto node = elem.first_node(); node; node = node->next_sibling())
14441 if (compare(node->local_name(), node->local_name_size(),
"UserId",
14444 id = user_id::from_xml_element(*node);
14446 else if (compare(node->local_name(), node->local_name_size(),
14447 "DelegatePermissions",
14448 strlen(
"DelegatePermissions")))
14450 perms = delegate_permissions::from_xml_element(*node);
14452 else if (compare(node->local_name(), node->local_name_size(),
14453 "ReceiveCopiesOfMeetingMessages",
14454 strlen(
"ReceiveCopiesOfMeetingMessages")))
14456 receive_copies =
true;
14458 else if (compare(node->local_name(), node->local_name_size(),
14459 "ViewPrivateItems", strlen(
"ViewPrivateItems")))
14461 view_private_items =
true;
14465 throw exception(
"Unexpected child element in <DelegateUser>");
14469 return delegate_user(
id, perms, receive_copies, view_private_items);
14472 std::string to_xml()
const 14474 std::stringstream sstr;
14475 sstr <<
"<t:DelegateUser>";
14476 sstr << user_id_.to_xml();
14477 sstr << permissions_.to_xml();
14478 sstr <<
"<t:ReceiveCopiesOfMeetingMessages>" 14479 << (receive_copies_ ?
"true" :
"false")
14480 <<
"</t:ReceiveCopiesOfMeetingMessages>";
14481 sstr <<
"<t:ViewPrivateItems>" 14482 << (view_private_items_ ?
"true" :
"false")
14483 <<
"</t:ViewPrivateItems>";
14484 sstr <<
"</t:DelegateUser>";
14491 bool receive_copies_;
14492 bool view_private_items_;
14495 #if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 14496 defined(EWS_HAS_CXX17_STATIC_ASSERT) 14497 static_assert(std::is_default_constructible<delegate_user>::value);
14498 static_assert(std::is_copy_constructible<delegate_user>::value);
14499 static_assert(std::is_copy_assignable<delegate_user>::value);
14500 static_assert(std::is_move_constructible<delegate_user>::value);
14501 static_assert(std::is_move_assignable<delegate_user>::value);
14532 throw exception(
"Unknown permission level");
14538 str_to_permission_level(
const std::string& str)
14541 if (str ==
"Editor")
14545 else if (str ==
"Author")
14549 else if (str ==
"Reviewer")
14553 else if (str ==
"Custom")
14606 throw exception(
"Unexpected <DelegationState>");
14632 inline std::string enum_to_str(
status s)
14637 return "NotStarted";
14639 return "InProgress";
14641 return "Completed";
14643 return "WaitingOnOthers";
14647 throw exception(
"Unexpected <Status>");
14694 inline std::string enum_to_str(
month m)
14715 return "September";
14727 inline month str_to_month(
const std::string& str)
14730 if (str ==
"January")
14734 else if (str ==
"February")
14738 else if (str ==
"March")
14742 else if (str ==
"April")
14746 else if (str ==
"May")
14750 else if (str ==
"June")
14754 else if (str ==
"July")
14758 else if (str ==
"August")
14762 else if (str ==
"September")
14766 else if (str ==
"October")
14770 else if (str ==
"November")
14774 else if (str ==
"December")
14833 return "Wednesday";
14845 return "WeekendDay";
14847 throw exception(
"Unexpected <DaysOfWeek>");
14851 inline day_of_week str_to_day_of_week(
const std::string& str)
14853 if (str ==
"Sunday")
14857 else if (str ==
"Monday")
14861 else if (str ==
"Tuesday")
14865 else if (str ==
"Wednesday")
14869 else if (str ==
"Thursday")
14873 else if (str ==
"Friday")
14877 else if (str ==
"Saturday")
14881 else if (str ==
"Day")
14885 else if (str ==
"Weekday")
14889 else if (str ==
"WeekendDay")
14895 throw exception(
"Unexpected <DaysOfWeek>");
14942 throw exception(
"Unexpected <DayOfWeekIndex>");
14948 if (str ==
"First")
14952 else if (str ==
"Second")
14956 else if (str ==
"Third")
14960 else if (str ==
"Fourth")
14964 else if (str ==
"Last")
14970 throw exception(
"Unexpected <DayOfWeekIndex>");
14979 #ifdef EWS_HAS_DEFAULT_AND_DELETE 14988 #ifndef EWS_DOXYGEN_SHOULD_SKIP_THIS 14989 task(
item_id&&
id, internal::xml_subtree&& properties)
14990 :
item(std::move(
id), std::move(properties))
15000 const auto val = xml().get_value_as_string(
"ActualWork");
15005 return std::stoi(val);
15013 xml().set_or_update(
"ActualWork", std::to_string(actual_work));
15023 return date_time(xml().get_value_as_string(
"AssignedTime"));
15029 return xml().get_value_as_string(
"BillingInformation");
15035 xml().set_or_update(
"BillingInformation", billing_info);
15046 const auto val = xml().get_value_as_string(
"ChangeCount");
15051 return std::stoi(val);
15062 return get_array_of_strings_helper(
"Companies");
15071 set_array_of_strings_helper(companies,
"Companies");
15077 return date_time(xml().get_value_as_string(
"CompleteDate"));
15083 return get_array_of_strings_helper(
"Contacts");
15089 set_array_of_strings_helper(contacts,
"Contacts");
15097 const auto& val = xml().get_value_as_string(
"DelegationState");
15099 if (val.empty() || val ==
"NoMatch")
15103 else if (val ==
"OwnNew")
15107 else if (val ==
"Owned")
15111 else if (val ==
"Accepted")
15115 else if (val ==
"Declined")
15119 else if (val ==
"Max")
15125 throw exception(
"Unexpected <DelegationState>");
15132 return xml().get_value_as_string(
"Delegator");
15138 xml().set_or_update(
"DueDate", due_date.to_string());
15144 return date_time(xml().get_value_as_string(
"DueDate"));
15150 int is_assignment_editable()
const 15168 return xml().get_value_as_string(
"IsComplete") ==
"true";
15174 return xml().get_value_as_string(
"IsRecurring") ==
"true";
15182 return xml().get_value_as_string(
"IsTeamTask") ==
"true";
15190 return xml().get_value_as_string(
"Mileage");
15196 xml().set_or_update(
"Mileage", mileage);
15203 std::string get_owner()
const 15205 return xml().get_value_as_string(
"Owner");
15214 const auto val = xml().get_value_as_string(
"PercentComplete");
15219 return std::stoi(val);
15231 xml().set_or_update(
"PercentComplete", std::to_string(value));
15240 xml().set_or_update(
"StartDate", start_date.to_string());
15246 return date_time(xml().get_value_as_string(
"StartDate"));
15252 const auto& val = xml().get_value_as_string(
"Status");
15253 if (val ==
"NotStarted")
15257 else if (val ==
"InProgress")
15261 else if (val ==
"Completed")
15265 else if (val ==
"WaitingOnOthers")
15269 else if (val ==
"Deferred")
15275 throw exception(
"Unexpected <Status>");
15282 xml().set_or_update(
"Status", internal::enum_to_str(s));
15291 return xml().get_value_as_string(
"StatusDescription");
15297 const auto val = xml().get_value_as_string(
"TotalWork");
15302 return std::stoi(val);
15308 xml().set_or_update(
"TotalWork", std::to_string(total_work));
15319 elem.first_node_ns(internal::uri<>::microsoft::types(),
"ItemId");
15320 check(id_node,
"Expected <ItemId>");
15322 internal::xml_subtree(elem));
15328 const std::string& item_tag_name()
const EWS_NOEXCEPT
15330 static const std::string name(
"Task");
15335 #if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 15336 defined(EWS_HAS_CXX17_STATIC_ASSERT) 15337 static_assert(std::is_default_constructible<task>::value);
15338 static_assert(std::is_copy_constructible<task>::value);
15339 static_assert(std::is_copy_assignable<task>::value);
15340 static_assert(std::is_move_constructible<task>::value);
15341 static_assert(std::is_move_assignable<task>::value);
15347 #ifdef EWS_HAS_DEFAULT_AND_DELETE 15354 std::string middlename, std::string lastname,
15355 std::string suffix, std::string initials,
15356 std::string fullname, std::string nickname)
15357 : title_(std::move(title)), firstname_(std::move(firstname)),
15358 middlename_(std::move(middlename)), lastname_(std::move(lastname)),
15359 suffix_(std::move(suffix)), initials_(std::move(initials)),
15360 fullname_(std::move(fullname)), nickname_(std::move(nickname))
15364 static complete_name from_xml_element(
const rapidxml::xml_node<char>& node)
15366 using namespace rapidxml::internal;
15368 std::string firstname;
15369 std::string middlename;
15370 std::string lastname;
15371 std::string suffix;
15372 std::string initials;
15373 std::string fullname;
15374 std::string nickname;
15375 for (
auto child = node.first_node(); child !=
nullptr;
15376 child = child->next_sibling())
15378 if (compare(
"Title", strlen(
"Title"), child->local_name(),
15379 child->local_name_size()))
15381 title = std::string(child->value(), child->value_size());
15383 else if (compare(
"FirstName", strlen(
"FirstName"),
15384 child->local_name(), child->local_name_size()))
15386 firstname = std::string(child->value(), child->value_size());
15388 else if (compare(
"MiddleName", strlen(
"MiddleName"),
15389 child->local_name(), child->local_name_size()))
15391 middlename = std::string(child->value(), child->value_size());
15393 else if (compare(
"LastName", strlen(
"LastName"),
15394 child->local_name(), child->local_name_size()))
15396 lastname = std::string(child->value(), child->value_size());
15398 else if (compare(
"Suffix", strlen(
"Suffix"), child->local_name(),
15399 child->local_name_size()))
15401 suffix = std::string(child->value(), child->value_size());
15403 else if (compare(
"Initials", strlen(
"Initials"),
15404 child->local_name(), child->local_name_size()))
15406 initials = std::string(child->value(), child->value_size());
15408 else if (compare(
"FullName", strlen(
"FullName"),
15409 child->local_name(), child->local_name_size()))
15411 fullname = std::string(child->value(), child->value_size());
15413 else if (compare(
"Nickname", strlen(
"Nickname"),
15414 child->local_name(), child->local_name_size()))
15416 nickname = std::string(child->value(), child->value_size());
15420 return complete_name(title, firstname, middlename, lastname, suffix,
15421 initials, fullname, nickname);
15424 const std::string& get_title()
const EWS_NOEXCEPT {
return title_; }
15425 const std::string& get_first_name()
const EWS_NOEXCEPT
15429 const std::string& get_middle_name()
const EWS_NOEXCEPT
15431 return middlename_;
15433 const std::string& get_last_name()
const EWS_NOEXCEPT {
return lastname_; }
15434 const std::string& get_suffix()
const EWS_NOEXCEPT {
return suffix_; }
15435 const std::string& get_initials()
const EWS_NOEXCEPT {
return initials_; }
15436 const std::string& get_full_name()
const EWS_NOEXCEPT {
return fullname_; }
15437 const std::string& get_nickname()
const EWS_NOEXCEPT {
return nickname_; }
15440 std::string title_;
15441 std::string firstname_;
15442 std::string middlename_;
15443 std::string lastname_;
15444 std::string suffix_;
15445 std::string initials_;
15446 std::string fullname_;
15447 std::string nickname_;
15461 : key_(std::move(k)), value_(std::move(value))
15466 from_xml_element(
const rapidxml::xml_node<char>& node);
15467 std::string to_xml()
const;
15468 key get_key()
const EWS_NOEXCEPT {
return key_; }
15469 const std::string& get_value()
const EWS_NOEXCEPT {
return value_; }
15473 std::string value_;
15479 inline email_address::key
15480 str_to_email_address_key(
const std::string& keystring)
15482 email_address::key k;
15483 if (keystring ==
"EmailAddress1")
15485 k = email_address::key::email_address_1;
15487 else if (keystring ==
"EmailAddress2")
15489 k = email_address::key::email_address_2;
15491 else if (keystring ==
"EmailAddress3")
15493 k = email_address::key::email_address_3;
15497 throw exception(
"Unrecognized key: " + keystring);
15502 inline std::string enum_to_str(email_address::key k)
15506 case email_address::key::email_address_1:
15507 return "EmailAddress1";
15508 case email_address::key::email_address_2:
15509 return "EmailAddress2";
15510 case email_address::key::email_address_3:
15511 return "EmailAddress3";
15519 email_address::from_xml_element(
const rapidxml::xml_node<char>& node)
15521 using namespace internal;
15522 using rapidxml::internal::compare;
15529 check(compare(node.local_name(), node.local_name_size(),
"Entry",
15531 "Expected <Entry> element");
15532 auto key = node.first_attribute(
"Key");
15533 check(key,
"Expected attribute 'Key'");
15535 str_to_email_address_key(std::string(key->value(), key->value_size())),
15536 std::string(node.value(), node.value_size()));
15539 inline std::string email_address::to_xml()
const 15541 std::stringstream sstr;
15543 <<
"EmailAddresses" 15545 sstr <<
" <t:Entry Key=";
15546 sstr <<
"\"" << internal::enum_to_str(get_key());
15548 sstr << get_value();
15549 sstr <<
"</t:Entry>";
15551 <<
"EmailAddresses" 15558 return (lhs.key_ == rhs.key_) && (lhs.value_ == rhs.value_);
15572 std::string state, std::string cor,
15573 std::string postal_code)
15574 : key_(std::move(k)), street_(std::move(street)),
15575 city_(std::move(city)), state_(std::move(state)),
15576 country_or_region_(std::move(cor)),
15577 postal_code_(std::move(postal_code))
15582 from_xml_element(
const rapidxml::xml_node<char>& node);
15583 std::string to_xml()
const;
15584 key get_key()
const EWS_NOEXCEPT {
return key_; }
15585 const std::string& street()
const EWS_NOEXCEPT {
return street_; }
15586 const std::string& city()
const EWS_NOEXCEPT {
return city_; }
15587 const std::string& state()
const EWS_NOEXCEPT {
return state_; }
15588 const std::string& country_or_region()
const EWS_NOEXCEPT
15590 return country_or_region_;
15592 const std::string& postal_code()
const EWS_NOEXCEPT {
return postal_code_; }
15596 std::string street_;
15598 std::string state_;
15599 std::string country_or_region_;
15600 std::string postal_code_;
15607 return (lhs.key_ == rhs.key_) && (lhs.street_ == rhs.street_) &&
15608 (lhs.city_ == rhs.city_) && (lhs.state_ == rhs.state_) &&
15609 (lhs.country_or_region_ == rhs.country_or_region_) &&
15610 (lhs.postal_code_ == rhs.postal_code_);
15615 inline physical_address::key
15616 string_to_physical_address_key(
const std::string& keystring)
15618 physical_address::key k;
15619 if (keystring ==
"Home")
15621 k = physical_address::key::home;
15623 else if (keystring ==
"Business")
15625 k = physical_address::key::business;
15627 else if (keystring ==
"Other")
15629 k = physical_address::key::other;
15633 throw exception(
"Unrecognized key: " + keystring);
15638 inline std::string enum_to_str(physical_address::key k)
15642 case physical_address::key::home:
15644 case physical_address::key::business:
15646 case physical_address::key::other:
15655 physical_address::from_xml_element(
const rapidxml::xml_node<char>& node)
15657 using namespace internal;
15658 using rapidxml::internal::compare;
15660 check(compare(node.local_name(), node.local_name_size(),
"Entry",
15662 "Expected <Entry>, got something else");
15672 auto key_attr = node.first_attribute();
15673 check(key_attr,
"Expected <Entry> to have an attribute");
15674 check(compare(key_attr->name(), key_attr->name_size(),
"Key", 3),
15675 "Expected <Entry> to have an attribute 'Key'");
15676 const key key = string_to_physical_address_key(key_attr->value());
15678 std::string street;
15682 std::string postal_code;
15684 for (
auto child = node.first_node(); child !=
nullptr;
15685 child = child->next_sibling())
15687 if (compare(
"Street", strlen(
"Street"), child->local_name(),
15688 child->local_name_size()))
15690 street = std::string(child->value(), child->value_size());
15692 if (compare(
"City", strlen(
"City"), child->local_name(),
15693 child->local_name_size()))
15695 city = std::string(child->value(), child->value_size());
15697 if (compare(
"State", strlen(
"State"), child->local_name(),
15698 child->local_name_size()))
15700 state = std::string(child->value(), child->value_size());
15702 if (compare(
"CountryOrRegion", strlen(
"CountryOrRegion"),
15703 child->local_name(), child->local_name_size()))
15705 cor = std::string(child->value(), child->value_size());
15707 if (compare(
"PostalCode", strlen(
"PostalCode"), child->local_name(),
15708 child->local_name_size()))
15710 postal_code = std::string(child->value(), child->value_size());
15716 inline std::string physical_address::to_xml()
const 15718 std::stringstream sstr;
15720 <<
"PhysicalAddresses" 15722 sstr <<
" <t:Entry Key=";
15723 sstr <<
"\"" << internal::enum_to_str(get_key());
15725 if (!street().empty())
15727 sstr <<
"<t:Street>";
15729 sstr <<
"</t:Street>";
15731 if (!city().empty())
15733 sstr <<
"<t:City>";
15735 sstr <<
"</t:City>";
15737 if (!state().empty())
15739 sstr <<
"<t:State>";
15741 sstr <<
"</t:State>";
15743 if (!country_or_region().empty())
15745 sstr <<
"<t:CountryOrRegion>";
15746 sstr << country_or_region();
15747 sstr <<
"</t:CountryOrRegion>";
15749 if (!postal_code().empty())
15751 sstr <<
"<t:PostalCode>";
15752 sstr << postal_code();
15753 sstr <<
"</t:PostalCode>";
15755 sstr <<
"</t:Entry>";
15757 <<
"PhysicalAddresses" 15764 enum file_as_mapping
15770 last_comma_first_company,
15771 company_last_first,
15773 last_first_company,
15774 company_last_comma_first,
15776 last_space_first_company,
15777 company_last_space_first,
15781 inline file_as_mapping str_to_map(
const std::string& maptype)
15783 file_as_mapping map;
15785 if (maptype ==
"LastCommaFirst")
15787 map = file_as_mapping::last_comma_first;
15789 else if (maptype ==
"FirstSpaceLast")
15791 map = file_as_mapping::first_space_last;
15793 else if (maptype ==
"Company")
15795 map = file_as_mapping::company;
15797 else if (maptype ==
"LastCommaFirstCompany")
15799 map = file_as_mapping::last_comma_first_company;
15801 else if (maptype ==
"CompanyLastFirst")
15803 map = file_as_mapping::company_last_first;
15805 else if (maptype ==
"LastFirst")
15807 map = file_as_mapping::last_first;
15809 else if (maptype ==
"LastFirstCompany")
15811 map = file_as_mapping::last_first_company;
15813 else if (maptype ==
"CompanyLastCommaFirst")
15815 map = file_as_mapping::company_last_comma_first;
15817 else if (maptype ==
"LastFirstSuffix")
15819 map = file_as_mapping::last_first_suffix;
15821 else if (maptype ==
"LastSpaceFirstCompany")
15823 map = file_as_mapping::last_space_first_company;
15825 else if (maptype ==
"CompanyLastSpaceFirst")
15827 map = file_as_mapping::company_last_space_first;
15829 else if (maptype ==
"LastSpaceFirst")
15831 map = file_as_mapping::last_space_first;
15833 else if (maptype ==
"None" || maptype ==
"")
15835 map = file_as_mapping::none;
15839 throw exception(std::string(
"Unrecognized FileAsMapping Type: ") +
15845 inline std::string enum_to_str(internal::file_as_mapping maptype)
15847 std::string mappingtype;
15850 case file_as_mapping::none:
15851 mappingtype =
"None";
15853 case file_as_mapping::last_comma_first:
15854 mappingtype =
"LastCommaFirst";
15856 case file_as_mapping::first_space_last:
15857 mappingtype =
"FirstSpaceLast";
15859 case file_as_mapping::company:
15860 mappingtype =
"Company";
15862 case file_as_mapping::last_comma_first_company:
15863 mappingtype =
"LastCommaFirstCompany";
15865 case file_as_mapping::company_last_first:
15866 mappingtype =
"CompanyLastFirst";
15868 case file_as_mapping::last_first:
15869 mappingtype =
"LastFirst";
15871 case file_as_mapping::last_first_company:
15872 mappingtype =
"LastFirstCompany";
15874 case file_as_mapping::company_last_comma_first:
15875 mappingtype =
"CompanyLastCommaFirst";
15877 case file_as_mapping::last_first_suffix:
15878 mappingtype =
"LastFirstSuffix";
15880 case file_as_mapping::last_space_first_company:
15881 mappingtype =
"LastSpaceFirstCompany";
15883 case file_as_mapping::company_last_space_first:
15884 mappingtype =
"CompanyLastSpaceFirst";
15886 case file_as_mapping::last_space_first:
15887 mappingtype =
"LastSpaceFirst";
15892 return mappingtype;
15907 : key_(std::move(k)), value_(std::move(value))
15911 static im_address from_xml_element(
const rapidxml::xml_node<char>& node);
15912 std::string to_xml()
const;
15914 key get_key()
const EWS_NOEXCEPT {
return key_; }
15915 const std::string& get_value()
const EWS_NOEXCEPT {
return value_; }
15919 std::string value_;
15925 inline std::string enum_to_str(im_address::key k)
15929 case im_address::key::imaddress1:
15930 return "ImAddress1";
15931 case im_address::key::imaddress2:
15932 return "ImAddress2";
15933 case im_address::key::imaddress3:
15934 return "ImAddress3";
15940 inline im_address::key str_to_im_address_key(
const std::string& keystring)
15943 if (keystring ==
"ImAddress1")
15945 k = im_address::key::imaddress1;
15947 else if (keystring ==
"ImAddress2")
15949 k = im_address::key::imaddress2;
15951 else if (keystring ==
"ImAddress3")
15953 k = im_address::key::imaddress3;
15957 throw exception(
"Unrecognized key: " + keystring);
15964 im_address::from_xml_element(
const rapidxml::xml_node<char>& node)
15966 using namespace internal;
15967 using rapidxml::internal::compare;
15969 check(compare(node.local_name(), node.local_name_size(),
"Entry",
15971 "Expected <Entry>, got something else");
15972 auto key = node.first_attribute(
"Key");
15973 check(key,
"Expected attribute 'Key'");
15975 str_to_im_address_key(std::string(key->value(), key->value_size())),
15976 std::string(node.value(), node.value_size()));
15979 inline std::string im_address::to_xml()
const 15981 std::stringstream sstr;
15985 sstr <<
" <t:Entry Key=";
15986 sstr <<
"\"" << internal::enum_to_str(key_);
15988 sstr << get_value();
15989 sstr <<
"</t:Entry>";
15998 return (lhs.key_ == rhs.key_) && (lhs.value_ == rhs.value_);
16012 company_main_phone,
16028 : key_(std::move(k)), value_(std::move(val))
16032 static phone_number from_xml_element(
const rapidxml::xml_node<char>& node);
16033 std::string to_xml()
const;
16034 key get_key()
const EWS_NOEXCEPT {
return key_; }
16035 const std::string& get_value()
const EWS_NOEXCEPT {
return value_; }
16039 std::string value_;
16045 inline phone_number::key
16046 str_to_phone_number_key(
const std::string& keystring)
16048 phone_number::key k;
16049 if (keystring ==
"AssistantPhone")
16051 k = phone_number::key::assistant_phone;
16053 else if (keystring ==
"BusinessFax")
16055 k = phone_number::key::business_fax;
16057 else if (keystring ==
"BusinessPhone")
16059 k = phone_number::key::business_phone;
16061 else if (keystring ==
"BusinessPhone2")
16063 k = phone_number::key::business_phone_2;
16065 else if (keystring ==
"Callback")
16067 k = phone_number::key::callback;
16069 else if (keystring ==
"CarPhone")
16071 k = phone_number::key::car_phone;
16073 else if (keystring ==
"CompanyMainPhone")
16075 k = phone_number::key::company_main_phone;
16077 else if (keystring ==
"HomeFax")
16079 k = phone_number::key::home_fax;
16081 else if (keystring ==
"HomePhone")
16083 k = phone_number::key::home_phone;
16085 else if (keystring ==
"HomePhone2")
16087 k = phone_number::key::home_phone_2;
16089 else if (keystring ==
"Isdn")
16091 k = phone_number::key::isdn;
16093 else if (keystring ==
"MobilePhone")
16095 k = phone_number::key::mobile_phone;
16097 else if (keystring ==
"OtherFax")
16099 k = phone_number::key::other_fax;
16101 else if (keystring ==
"OtherTelephone")
16103 k = phone_number::key::other_telephone;
16105 else if (keystring ==
"Pager")
16107 k = phone_number::key::pager;
16109 else if (keystring ==
"PrimaryPhone")
16111 k = phone_number::key::primary_phone;
16113 else if (keystring ==
"RadioPhone")
16115 k = phone_number::key::radio_phone;
16117 else if (keystring ==
"Telex")
16119 k = phone_number::key::telex;
16121 else if (keystring ==
"TtyTddPhone")
16123 k = phone_number::key::ttytdd_phone;
16127 throw exception(
"Unrecognized key: " + keystring);
16132 inline std::string enum_to_str(phone_number::key k)
16136 case phone_number::key::assistant_phone:
16137 return "AssistantPhone";
16138 case phone_number::key::business_fax:
16139 return "BusinessFax";
16140 case phone_number::key::business_phone:
16141 return "BusinessPhone";
16142 case phone_number::key::business_phone_2:
16143 return "BusinessPhone2";
16144 case phone_number::key::callback:
16146 case phone_number::key::car_phone:
16148 case phone_number::key::company_main_phone:
16149 return "CompanyMainPhone";
16150 case phone_number::key::home_fax:
16152 case phone_number::key::home_phone:
16153 return "HomePhone";
16154 case phone_number::key::home_phone_2:
16155 return "HomePhone2";
16156 case phone_number::key::isdn:
16158 case phone_number::key::mobile_phone:
16159 return "MobilePhone";
16160 case phone_number::key::other_fax:
16162 case phone_number::key::other_telephone:
16163 return "OtherTelephone";
16164 case phone_number::key::pager:
16166 case phone_number::key::primary_phone:
16167 return "PrimaryPhone";
16168 case phone_number::key::radio_phone:
16169 return "RadioPhone";
16170 case phone_number::key::telex:
16172 case phone_number::key::ttytdd_phone:
16173 return "TtyTddPhone";
16181 phone_number::from_xml_element(
const rapidxml::xml_node<char>& node)
16183 using namespace internal;
16184 using rapidxml::internal::compare;
16191 check(compare(node.local_name(), node.local_name_size(),
"Entry",
16193 "Expected <Entry>, got something else");
16194 auto key = node.first_attribute(
"Key");
16195 check(key,
"Expected attribute 'Key'");
16197 str_to_phone_number_key(std::string(key->value(), key->value_size())),
16198 std::string(node.value(), node.value_size()));
16201 inline std::string phone_number::to_xml()
const 16203 std::stringstream sstr;
16207 sstr <<
" <t:Entry Key=";
16208 sstr <<
"\"" << internal::enum_to_str(key_);
16210 sstr << get_value();
16211 sstr <<
"</t:Entry>";
16220 return (lhs.key_ == rhs.key_) && (lhs.value_ == rhs.value_);
16227 #ifdef EWS_HAS_DEFAULT_AND_DELETE 16235 #ifndef EWS_DOXYGEN_SHOULD_SKIP_THIS 16237 :
item(std::move(
id), std::move(properties))
16245 xml().set_or_update(
"FileAs", fileas);
16248 std::string get_file_as()
const 16250 return xml().get_value_as_string(
"FileAs");
16258 auto mapping = internal::enum_to_str(maptype);
16259 xml().set_or_update(
"FileAsMapping", mapping);
16262 internal::file_as_mapping get_file_as_mapping()
const 16264 return internal::str_to_map(xml().get_value_as_string(
"FileAsMapping"));
16270 xml().set_or_update(
"DisplayName", display_name);
16276 return xml().get_value_as_string(
"DisplayName");
16283 xml().set_or_update(
"GivenName", given_name);
16289 return xml().get_value_as_string(
"GivenName");
16295 xml().set_or_update(
"Initials", initials);
16301 return xml().get_value_as_string(
"Initials");
16307 xml().set_or_update(
"MiddleName", middle_name);
16313 return xml().get_value_as_string(
"MiddleName");
16319 xml().set_or_update(
"Nickname", nickname);
16325 return xml().get_value_as_string(
"Nickname");
16331 auto node = xml().get_node(
"CompleteName");
16332 if (node ==
nullptr)
16336 return complete_name::from_xml_element(*node);
16342 xml().set_or_update(
"CompanyName", company_name);
16348 return xml().get_value_as_string(
"CompanyName");
16354 const auto addresses = xml().get_node(
"EmailAddresses");
16357 return std::vector<email_address>();
16359 std::vector<email_address> result;
16360 for (
auto entry = addresses->first_node(); entry !=
nullptr;
16361 entry = entry->next_sibling())
16363 result.push_back(email_address::from_xml_element(*entry));
16370 using internal::create_node;
16371 using rapidxml::internal::compare;
16372 auto doc = xml().document();
16373 auto email_addresses = xml().get_node(
"EmailAddresses");
16375 if (email_addresses)
16377 bool entry_exists =
false;
16378 auto entry = email_addresses->first_node();
16379 for (; entry !=
nullptr; entry = entry->next_sibling())
16381 auto key_attr = entry->first_attribute();
16382 check(key_attr,
"Expected an attribute");
16384 compare(key_attr->name(), key_attr->name_size(),
"Key", 3),
16385 "Expected an attribute 'Key'");
16386 const auto key = internal::enum_to_str(address.get_key());
16387 if (compare(key_attr->value(), key_attr->value_size(),
16388 key.c_str(), key.size()))
16390 entry_exists =
true;
16396 email_addresses->remove_node(entry);
16401 email_addresses = &create_node(*doc,
"t:EmailAddresses");
16405 const auto value = address.get_value();
16406 auto new_entry = &create_node(*email_addresses,
"t:Entry", value);
16407 auto ptr_to_key = doc->allocate_string(
"Key");
16408 const auto key = internal::enum_to_str(address.get_key());
16409 auto ptr_to_value = doc->allocate_string(key.c_str());
16410 new_entry->append_attribute(
16411 doc->allocate_attribute(ptr_to_key, ptr_to_value));
16417 const auto addresses = xml().get_node(
"PhysicalAddresses");
16420 return std::vector<physical_address>();
16422 std::vector<physical_address> result;
16423 for (
auto entry = addresses->first_node(); entry !=
nullptr;
16424 entry = entry->next_sibling())
16426 result.push_back(physical_address::from_xml_element(*entry));
16433 using internal::create_node;
16434 using rapidxml::internal::compare;
16435 auto doc = xml().document();
16436 auto addresses = xml().get_node(
"PhysicalAddresses");
16456 bool entry_exists =
false;
16457 auto entry = addresses->first_node();
16458 for (; entry !=
nullptr; entry = entry->next_sibling())
16460 auto key_attr = entry->first_attribute();
16461 check(key_attr,
"Expected an attribute");
16463 compare(key_attr->name(), key_attr->name_size(),
"Key", 3),
16464 "Expected an attribute 'Key'");
16465 const auto key = internal::enum_to_str(address.get_key());
16466 if (compare(key_attr->value(), key_attr->value_size(),
16467 key.c_str(), key.size()))
16469 entry_exists =
true;
16475 addresses->remove_node(entry);
16480 addresses = &create_node(*doc,
"t:PhysicalAddresses");
16484 auto new_entry = &create_node(*addresses,
"t:Entry");
16486 auto ptr_to_key = doc->allocate_string(
"Key");
16487 auto keystr = internal::enum_to_str(address.get_key());
16488 auto ptr_to_value = doc->allocate_string(keystr.c_str());
16489 new_entry->append_attribute(
16490 doc->allocate_attribute(ptr_to_key, ptr_to_value));
16492 if (!address.street().empty())
16494 create_node(*new_entry,
"t:Street", address.street());
16496 if (!address.city().empty())
16498 create_node(*new_entry,
"t:City", address.city());
16500 if (!address.state().empty())
16502 create_node(*new_entry,
"t:State", address.state());
16504 if (!address.country_or_region().empty())
16506 create_node(*new_entry,
"t:CountryOrRegion",
16507 address.country_or_region());
16509 if (!address.postal_code().empty())
16511 create_node(*new_entry,
"t:PostalCode", address.postal_code());
16518 using internal::create_node;
16519 using rapidxml::internal::compare;
16520 auto doc = xml().document();
16521 auto phone_numbers = xml().get_node(
"PhoneNumbers");
16525 bool entry_exists =
false;
16526 auto entry = phone_numbers->first_node();
16527 for (; entry !=
nullptr; entry = entry->next_sibling())
16529 auto key_attr = entry->first_attribute();
16530 check(key_attr,
"Expected an attribute");
16532 compare(key_attr->name(), key_attr->name_size(),
"Key", 3),
16533 "Expected an attribute 'Key'");
16534 const auto key = internal::enum_to_str(number.get_key());
16535 if (compare(key_attr->value(), key_attr->value_size(),
16536 key.c_str(), key.size()))
16538 entry_exists =
true;
16544 phone_numbers->remove_node(entry);
16549 phone_numbers = &create_node(*doc,
"t:PhoneNumbers");
16553 const auto value = number.get_value();
16554 auto new_entry = &create_node(*phone_numbers,
"t:Entry", value);
16555 auto ptr_to_key = doc->allocate_string(
"Key");
16556 const auto key = internal::enum_to_str(number.get_key());
16557 auto ptr_to_value = doc->allocate_string(key.c_str());
16558 new_entry->append_attribute(
16559 doc->allocate_attribute(ptr_to_key, ptr_to_value));
16562 std::vector<phone_number> get_phone_numbers()
const 16564 const auto numbers = xml().get_node(
"PhoneNumbers");
16567 return std::vector<phone_number>();
16569 std::vector<phone_number> result;
16570 for (
auto entry = numbers->first_node(); entry !=
nullptr;
16571 entry = entry->next_sibling())
16573 result.push_back(phone_number::from_xml_element(*entry));
16581 xml().set_or_update(
"AssistantName", assistant_name);
16587 return xml().get_value_as_string(
"AssistantName");
16600 xml().set_or_update(
"Birthday", birthday);
16603 std::string get_birthday()
const 16605 return xml().get_value_as_string(
"Birthday");
16611 xml().set_or_update(
"BusinessHomePage", business_homepage);
16617 return xml().get_value_as_string(
"BusinessHomePage");
16623 set_array_of_strings_helper(children,
"Children");
16626 std::vector<std::string> get_children()
const 16628 return get_array_of_strings_helper(
"Children");
16634 set_array_of_strings_helper(companies,
"Companies");
16637 std::vector<std::string> get_companies()
const 16639 return get_array_of_strings_helper(
"Companies");
16647 return xml().get_value_as_string(
"ContactSource");
16653 xml().set_or_update(
"Department", department);
16659 return xml().get_value_as_string(
"Department");
16666 xml().set_or_update(
"Generation", generation);
16672 return xml().get_value_as_string(
"Generation");
16679 using internal::create_node;
16680 using rapidxml::internal::compare;
16681 auto doc = xml().document();
16682 auto im_addresses = xml().get_node(
"ImAddresses");
16686 bool entry_exists =
false;
16687 auto entry = im_addresses->first_node();
16688 for (; entry !=
nullptr; entry = entry->next_sibling())
16690 auto key_attr = entry->first_attribute();
16691 check(key_attr,
"Expected an attribute");
16693 compare(key_attr->name(), key_attr->name_size(),
"Key", 3),
16694 "Expected an attribute 'Key'");
16695 const auto key = internal::enum_to_str(im_address.get_key());
16696 if (compare(key_attr->value(), key_attr->value_size(),
16697 key.c_str(), key.size()))
16699 entry_exists =
true;
16705 im_addresses->remove_node(entry);
16710 im_addresses = &create_node(*doc,
"t:ImAddresses");
16714 const auto value = im_address.get_value();
16715 auto new_entry = &create_node(*im_addresses,
"t:Entry", value);
16716 auto ptr_to_key = doc->allocate_string(
"Key");
16717 const auto key = internal::enum_to_str(im_address.get_key());
16718 auto ptr_to_value = doc->allocate_string(key.c_str());
16719 new_entry->append_attribute(
16720 doc->allocate_attribute(ptr_to_key, ptr_to_value));
16723 std::vector<im_address> get_im_addresses()
const 16725 const auto addresses = xml().get_node(
"ImAddresses");
16728 return std::vector<im_address>();
16730 std::vector<im_address> result;
16731 for (
auto entry = addresses->first_node(); entry !=
nullptr;
16732 entry = entry->next_sibling())
16734 result.push_back(im_address::from_xml_element(*entry));
16742 xml().set_or_update(
"JobTitle", title);
16748 return xml().get_value_as_string(
"JobTitle");
16754 xml().set_or_update(
"Manager", manager);
16760 return xml().get_value_as_string(
"Manager");
16767 xml().set_or_update(
"Mileage", mileage);
16773 return xml().get_value_as_string(
"Mileage");
16779 xml().set_or_update(
"OfficeLocation", office_location);
16785 return xml().get_value_as_string(
"OfficeLocation");
16795 xml().set_or_update(
"Profession", profession);
16801 return xml().get_value_as_string(
"Profession");
16807 xml().set_or_update(
"SpouseName", spouse_name);
16813 return xml().get_value_as_string(
"SpouseName");
16820 xml().set_or_update(
"Surname", surname);
16827 return xml().get_value_as_string(
"Surname");
16833 xml().set_or_update(
"WeddingAnniversary", anniversary);
16836 std::string get_wedding_anniversary()
const 16838 return xml().get_value_as_string(
"WeddingAnniversary");
16856 std::string get_user_smime_certificate()
const 16858 const auto node = xml().get_node(
"UserSMIMECertificate");
16863 auto base64binary = node->first_node_ns(
16864 internal::uri<>::microsoft::types(),
"Base64Binary");
16865 return base64binary ? std::string(base64binary->value(),
16866 base64binary->value_size())
16870 std::string get_msexchange_certificate()
const 16872 const auto node = xml().get_node(
"MSExchangeCertificate");
16877 auto base64binary = node->first_node_ns(
16878 internal::uri<>::microsoft::types(),
"Base64Binary");
16879 return base64binary ? std::string(base64binary->value(),
16880 base64binary->value_size())
16888 elem.first_node_ns(internal::uri<>::microsoft::types(),
"ItemId");
16889 check(id_node,
"Expected <ItemId>");
16891 internal::xml_subtree(elem));
16900 return contact(std::move(
id), internal::xml_subtree(elem));
16906 const std::string& item_tag_name()
const EWS_NOEXCEPT
16908 static const std::string name(
"Contact");
16913 std::string get_email_address_by_key(
const char* key)
const 16915 using rapidxml::internal::compare;
16918 const auto addresses = xml().get_node(
"EmailAddresses");
16923 for (
auto entry = addresses->first_node(); entry;
16924 entry = entry->next_sibling())
16926 for (
auto attr = entry->first_attribute(); attr;
16927 attr = attr->next_attribute())
16929 if (compare(attr->name(), attr->name_size(),
"Key", 3) &&
16930 compare(attr->value(), attr->value_size(), key,
16933 return std::string(entry->value(), entry->value_size());
16942 void set_email_address_by_key(
const char* key,
mailbox&& mail)
16944 using internal::create_node;
16945 using rapidxml::internal::compare;
16947 auto doc = xml().document();
16948 auto addresses = xml().get_node(
"EmailAddresses");
16953 bool exists =
false;
16954 auto entry = addresses->first_node();
16955 for (; entry && !exists; entry = entry->next_sibling())
16957 for (
auto attr = entry->first_attribute(); attr;
16958 attr = attr->next_attribute())
16960 if (compare(attr->name(), attr->name_size(),
"Key", 3) &&
16961 compare(attr->value(), attr->value_size(), key,
16971 addresses->remove_node(entry);
16977 addresses = &create_node(*doc,
"t:EmailAddresses");
16981 auto new_entry = &create_node(*addresses,
"t:Entry", mail.value());
16982 auto ptr_to_key = doc->allocate_string(
"Key");
16983 auto ptr_to_value = doc->allocate_string(key);
16984 new_entry->append_attribute(
16985 doc->allocate_attribute(ptr_to_key, ptr_to_value));
16986 if (!mail.name().empty())
16988 ptr_to_key = doc->allocate_string(
"Name");
16989 ptr_to_value = doc->allocate_string(mail.name().c_str());
16990 new_entry->append_attribute(
16991 doc->allocate_attribute(ptr_to_key, ptr_to_value));
16993 if (!mail.routing_type().empty())
16995 ptr_to_key = doc->allocate_string(
"RoutingType");
16996 ptr_to_value = doc->allocate_string(mail.routing_type().c_str());
16997 new_entry->append_attribute(
16998 doc->allocate_attribute(ptr_to_key, ptr_to_value));
17000 if (!mail.mailbox_type().empty())
17002 ptr_to_key = doc->allocate_string(
"MailboxType");
17003 ptr_to_value = doc->allocate_string(mail.mailbox_type().c_str());
17004 new_entry->append_attribute(
17005 doc->allocate_attribute(ptr_to_key, ptr_to_value));
17010 #if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 17011 defined(EWS_HAS_CXX17_STATIC_ASSERT) 17012 static_assert(std::is_default_constructible<contact>::value);
17013 static_assert(std::is_copy_constructible<contact>::value);
17014 static_assert(std::is_copy_assignable<contact>::value);
17015 static_assert(std::is_move_constructible<contact>::value);
17016 static_assert(std::is_move_assignable<contact>::value);
17028 #ifdef EWS_HAS_DEFAULT_AND_DELETE 17036 : item_id_(std::move(
id)), start_(std::move(start)),
17037 end_(std::move(end)), original_start_(std::move(original_start))
17042 bool none() const EWS_NOEXCEPT {
return !item_id_.valid(); }
17044 const item_id& get_item_id()
const EWS_NOEXCEPT {
return item_id_; }
17046 const date_time& get_start()
const EWS_NOEXCEPT {
return start_; }
17048 const date_time& get_end()
const EWS_NOEXCEPT {
return end_; }
17050 const date_time& get_original_start()
const EWS_NOEXCEPT
17052 return original_start_;
17059 using rapidxml::internal::compare;
17066 for (
auto node = elem.first_node(); node; node = node->next_sibling())
17068 if (compare(node->local_name(), node->local_name_size(),
17069 "OriginalStart", strlen(
"OriginalStart")))
17072 date_time(std::string(node->value(), node->value_size()));
17074 else if (compare(node->local_name(), node->local_name_size(),
"End",
17077 end =
date_time(std::string(node->value(), node->value_size()));
17079 else if (compare(node->local_name(), node->local_name_size(),
17080 "Start", strlen(
"Start")))
17083 date_time(std::string(node->value(), node->value_size()));
17085 else if (compare(node->local_name(), node->local_name_size(),
17086 "ItemId", strlen(
"ItemId")))
17092 throw exception(
"Unexpected child element in <Mailbox>");
17096 return occurrence_info(std::move(
id), std::move(start), std::move(end),
17097 std::move(original_start));
17107 #if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 17108 defined(EWS_HAS_CXX17_STATIC_ASSERT) 17109 static_assert(std::is_default_constructible<occurrence_info>::value);
17110 static_assert(std::is_copy_constructible<occurrence_info>::value);
17111 static_assert(std::is_copy_assignable<occurrence_info>::value);
17112 static_assert(std::is_move_constructible<occurrence_info>::value);
17113 static_assert(std::is_move_assignable<occurrence_info>::value);
17120 virtual std::string get_occurence_name() {
return "recurrence_pattern"; }
17121 #ifdef EWS_HAS_DEFAULT_AND_DELETE 17136 std::string to_xml()
const {
return this->to_xml_impl(); }
17144 return this->to_xml_element_impl(parent);
17149 static std::unique_ptr<recurrence_pattern>
17150 from_xml_element(
const rapidxml::xml_node<>& elem);
17153 #ifdef EWS_HAS_DEFAULT_AND_DELETE 17160 virtual std::string to_xml_impl()
const = 0;
17162 virtual rapidxml::xml_node<>&
17163 to_xml_element_impl(rapidxml::xml_node<>&)
const = 0;
17166 #if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 17167 defined(EWS_HAS_CXX17_STATIC_ASSERT) 17168 static_assert(!std::is_default_constructible<recurrence_pattern>::value);
17169 static_assert(!std::is_copy_constructible<recurrence_pattern>::value);
17170 static_assert(!std::is_copy_assignable<recurrence_pattern>::value);
17171 static_assert(!std::is_move_constructible<recurrence_pattern>::value);
17172 static_assert(!std::is_move_assignable<recurrence_pattern>::value);
17185 : days_of_week_(days_of_week), index_(index), month_(m)
17189 std::string get_occurence_name()
override 17191 return "relative_yearly_recurrence";
17194 day_of_week get_days_of_week()
const EWS_NOEXCEPT {
return days_of_week_; }
17201 month get_month()
const EWS_NOEXCEPT {
return month_; }
17208 std::string to_xml_impl()
const override 17210 using namespace internal;
17212 std::stringstream sstr;
17213 sstr <<
"<t:RelativeYearlyRecurrence>" 17214 <<
"<t:DaysOfWeek>" << enum_to_str(days_of_week_)
17215 <<
"</t:DaysOfWeek>" 17216 <<
"<t:DayOfWeekIndex>" << enum_to_str(index_)
17217 <<
"</t:DayOfWeekIndex>" 17218 <<
"<t:Month>" << enum_to_str(month_) <<
"</t:Month>" 17219 <<
"</t:RelativeYearlyRecurrence>";
17223 rapidxml::xml_node<>&
17224 to_xml_element_impl(rapidxml::xml_node<>& parent)
const override 17226 check(parent.document(),
"Parent node needs to be part of a document");
17228 using namespace internal;
17229 auto& pattern_node = create_node(parent,
"t:RelativeYearlyRecurrence");
17230 create_node(pattern_node,
"t:DaysOfWeek", enum_to_str(days_of_week_));
17231 create_node(pattern_node,
"t:DayOfWeekIndex", enum_to_str(index_));
17232 create_node(pattern_node,
"t:Month", enum_to_str(month_));
17233 return pattern_node;
17237 #if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 17238 defined(EWS_HAS_CXX17_STATIC_ASSERT) 17240 !std::is_default_constructible<relative_yearly_recurrence>::value);
17241 static_assert(!std::is_copy_constructible<relative_yearly_recurrence>::value);
17242 static_assert(!std::is_copy_assignable<relative_yearly_recurrence>::value);
17243 static_assert(!std::is_move_constructible<relative_yearly_recurrence>::value);
17244 static_assert(!std::is_move_assignable<relative_yearly_recurrence>::value);
17252 : day_of_month_(day_of_month), month_(m)
17256 std::string get_occurence_name()
override 17258 return "absolute_yearly_recurrence";
17261 uint32_t get_day_of_month()
const EWS_NOEXCEPT {
return day_of_month_; }
17263 month get_month()
const EWS_NOEXCEPT {
return month_; }
17266 uint32_t day_of_month_;
17269 std::string to_xml_impl()
const override 17271 using namespace internal;
17273 std::stringstream sstr;
17274 sstr <<
"<t:AbsoluteYearlyRecurrence>" 17275 <<
"<t:DayOfMonth>" << day_of_month_ <<
"</t:DayOfMonth>" 17276 <<
"<t:Month>" << enum_to_str(month_) <<
"</t:Month>" 17277 <<
"</t:AbsoluteYearlyRecurrence>";
17281 rapidxml::xml_node<>&
17282 to_xml_element_impl(rapidxml::xml_node<>& parent)
const override 17284 using namespace internal;
17285 check(parent.document(),
"Parent node needs to be part of a document");
17287 auto& pattern_node = create_node(parent,
"t:AbsoluteYearlyRecurrence");
17288 create_node(pattern_node,
"t:DayOfMonth",
17289 std::to_string(day_of_month_));
17290 create_node(pattern_node,
"t:Month", internal::enum_to_str(month_));
17291 return pattern_node;
17295 #if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 17296 defined(EWS_HAS_CXX17_STATIC_ASSERT) 17298 !std::is_default_constructible<absolute_yearly_recurrence>::value);
17299 static_assert(!std::is_copy_constructible<absolute_yearly_recurrence>::value);
17300 static_assert(!std::is_copy_assignable<absolute_yearly_recurrence>::value);
17301 static_assert(!std::is_move_constructible<absolute_yearly_recurrence>::value);
17302 static_assert(!std::is_move_assignable<absolute_yearly_recurrence>::value);
17323 : interval_(interval), day_of_month_(day_of_month)
17327 std::string get_occurence_name()
override 17329 return "absolute_monthly_recurrence";
17332 uint32_t get_interval()
const EWS_NOEXCEPT {
return interval_; }
17334 uint32_t get_days_of_month()
const EWS_NOEXCEPT {
return day_of_month_; }
17337 uint32_t interval_;
17338 uint32_t day_of_month_;
17340 std::string to_xml_impl()
const override 17342 using namespace internal;
17344 std::stringstream sstr;
17345 sstr <<
"<t:AbsoluteMonthlyRecurrence>" 17346 <<
"<t:Interval>" << interval_ <<
"</t:Interval>" 17347 <<
"<t:DayOfMonth>" << day_of_month_ <<
"</t:DayOfMonth>" 17348 <<
"</t:AbsoluteMonthlyRecurrence>";
17352 rapidxml::xml_node<>&
17353 to_xml_element_impl(rapidxml::xml_node<>& parent)
const override 17355 using internal::create_node;
17356 check(parent.document(),
"Parent node needs to be part of a document");
17358 auto& pattern_node = create_node(parent,
"t:AbsoluteMonthlyRecurrence");
17359 create_node(pattern_node,
"t:Interval", std::to_string(interval_));
17360 create_node(pattern_node,
"t:DayOfMonth",
17361 std::to_string(day_of_month_));
17362 return pattern_node;
17366 #if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 17367 defined(EWS_HAS_CXX17_STATIC_ASSERT) 17369 !std::is_default_constructible<absolute_monthly_recurrence>::value);
17370 static_assert(!std::is_copy_constructible<absolute_monthly_recurrence>::value);
17371 static_assert(!std::is_copy_assignable<absolute_monthly_recurrence>::value);
17372 static_assert(!std::is_move_constructible<absolute_monthly_recurrence>::value);
17373 static_assert(!std::is_move_assignable<absolute_monthly_recurrence>::value);
17398 : interval_(interval), days_of_week_(days_of_week), index_(index)
17402 std::string get_occurence_name()
override 17404 return "relative_monthly_recurrence";
17407 uint32_t get_interval()
const EWS_NOEXCEPT {
return interval_; }
17409 day_of_week get_days_of_week()
const EWS_NOEXCEPT {
return days_of_week_; }
17417 uint32_t interval_;
17421 std::string to_xml_impl()
const override 17423 using namespace internal;
17425 std::stringstream sstr;
17426 sstr <<
"<t:RelativeMonthlyRecurrence>" 17427 <<
"<t:Interval>" << interval_ <<
"</t:Interval>" 17428 <<
"<t:DaysOfWeek>" << enum_to_str(days_of_week_)
17429 <<
"</t:DaysOfWeek>" 17430 <<
"<t:DayOfWeekIndex>" << enum_to_str(index_)
17431 <<
"</t:DayOfWeekIndex>" 17432 <<
"</t:RelativeMonthlyRecurrence>";
17436 rapidxml::xml_node<>&
17437 to_xml_element_impl(rapidxml::xml_node<>& parent)
const override 17439 using internal::create_node;
17440 auto& pattern_node = create_node(parent,
"t:RelativeMonthlyRecurrence");
17441 create_node(pattern_node,
"t:Interval", std::to_string(interval_));
17442 create_node(pattern_node,
"t:DaysOfWeek",
17443 internal::enum_to_str(days_of_week_));
17444 create_node(pattern_node,
"t:DayOfWeekIndex",
17445 internal::enum_to_str(index_));
17446 return pattern_node;
17450 #if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 17451 defined(EWS_HAS_CXX17_STATIC_ASSERT) 17453 !std::is_default_constructible<relative_monthly_recurrence>::value);
17454 static_assert(!std::is_copy_constructible<relative_monthly_recurrence>::value);
17455 static_assert(!std::is_copy_assignable<relative_monthly_recurrence>::value);
17456 static_assert(!std::is_move_constructible<relative_monthly_recurrence>::value);
17457 static_assert(!std::is_move_assignable<relative_monthly_recurrence>::value);
17474 : interval_(interval), days_of_week_(),
17475 first_day_of_week_(first_day_of_week)
17477 days_of_week_.push_back(days_of_week);
17482 : interval_(interval), days_of_week_(std::move(days_of_week)),
17483 first_day_of_week_(first_day_of_week)
17487 std::string get_occurence_name()
override {
return "weekly_recurrence"; }
17489 uint32_t get_interval()
const EWS_NOEXCEPT {
return interval_; }
17491 const std::vector<day_of_week>& get_days_of_week()
const EWS_NOEXCEPT
17493 return days_of_week_;
17496 day_of_week get_first_day_of_week()
const EWS_NOEXCEPT
17498 return first_day_of_week_;
17502 uint32_t interval_;
17503 std::vector<day_of_week> days_of_week_;
17506 std::string to_xml_impl()
const override 17508 using namespace internal;
17511 for (
const auto&
day : days_of_week_)
17513 value += enum_to_str(
day) +
" ";
17515 value.resize(value.size() - 1);
17516 std::stringstream sstr;
17517 sstr <<
"<t:WeeklyRecurrence>" 17518 <<
"<t:Interval>" << interval_ <<
"</t:Interval>" 17519 <<
"<t:DaysOfWeek>" << value <<
"</t:DaysOfWeek>" 17520 <<
"<t:FirstDayOfWeek>" << enum_to_str(first_day_of_week_)
17521 <<
"</t:FirstDayOfWeek>" 17522 <<
"</t:WeeklyRecurrence>";
17526 rapidxml::xml_node<>&
17527 to_xml_element_impl(rapidxml::xml_node<>& parent)
const override 17529 using namespace internal;
17530 check(parent.document(),
"Parent node needs to be part of a document");
17532 auto& pattern_node = create_node(parent,
"t:WeeklyRecurrence");
17533 create_node(pattern_node,
"t:Interval", std::to_string(interval_));
17535 for (
const auto&
day : days_of_week_)
17537 value += enum_to_str(
day) +
" ";
17540 create_node(pattern_node,
"t:DaysOfWeek", value);
17541 create_node(pattern_node,
"t:FirstDayOfWeek",
17542 enum_to_str(first_day_of_week_));
17543 return pattern_node;
17547 #if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 17548 defined(EWS_HAS_CXX17_STATIC_ASSERT) 17549 static_assert(!std::is_default_constructible<weekly_recurrence>::value);
17550 static_assert(!std::is_copy_constructible<weekly_recurrence>::value);
17551 static_assert(!std::is_copy_assignable<weekly_recurrence>::value);
17552 static_assert(!std::is_move_constructible<weekly_recurrence>::value);
17553 static_assert(!std::is_move_assignable<weekly_recurrence>::value);
17562 std::string get_occurence_name()
override {
return "daily_recurrence"; }
17564 uint32_t get_interval()
const EWS_NOEXCEPT {
return interval_; }
17567 uint32_t interval_;
17569 std::string to_xml_impl()
const override 17571 using namespace internal;
17573 std::stringstream sstr;
17574 sstr <<
"<t:DailyRecurrence>" 17575 <<
"<t:Interval>" << interval_ <<
"</t:Interval>" 17576 <<
"</t:DailyRecurrence>";
17580 rapidxml::xml_node<>&
17581 to_xml_element_impl(rapidxml::xml_node<>& parent)
const override 17583 using internal::create_node;
17584 check(parent.document(),
"Parent node needs to be part of a document");
17586 auto& pattern_node = create_node(parent,
"t:DailyRecurrence");
17587 create_node(pattern_node,
"t:Interval", std::to_string(interval_));
17588 return pattern_node;
17592 #if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 17593 defined(EWS_HAS_CXX17_STATIC_ASSERT) 17594 static_assert(!std::is_default_constructible<daily_recurrence>::value);
17595 static_assert(!std::is_copy_constructible<daily_recurrence>::value);
17596 static_assert(!std::is_copy_assignable<daily_recurrence>::value);
17597 static_assert(!std::is_move_constructible<daily_recurrence>::value);
17598 static_assert(!std::is_move_assignable<daily_recurrence>::value);
17605 virtual std::string get_reccurence_range_name() {
return "recurrence_range"; }
17606 #ifdef EWS_HAS_DEFAULT_AND_DELETE 17620 std::string to_xml()
const {
return this->to_xml_impl(); }
17628 return this->to_xml_element_impl(parent);
17632 static std::unique_ptr<recurrence_range>
17633 from_xml_element(
const rapidxml::xml_node<>& elem);
17636 #ifdef EWS_HAS_DEFAULT_AND_DELETE 17643 virtual std::string to_xml_impl()
const = 0;
17645 virtual rapidxml::xml_node<>&
17646 to_xml_element_impl(rapidxml::xml_node<>&)
const = 0;
17649 #if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 17650 defined(EWS_HAS_CXX17_STATIC_ASSERT) 17651 static_assert(!std::is_default_constructible<recurrence_range>::value);
17652 static_assert(!std::is_copy_constructible<recurrence_range>::value);
17653 static_assert(!std::is_copy_assignable<recurrence_range>::value);
17654 static_assert(!std::is_move_constructible<recurrence_range>::value);
17655 static_assert(!std::is_move_assignable<recurrence_range>::value);
17663 : start_date_(std::move(start_date))
17667 std::string get_reccurence_range_name()
override {
return "no_end_recurrence_range"; }
17669 const date_time& get_start_date()
const EWS_NOEXCEPT {
return start_date_; }
17674 std::string to_xml_impl()
const override 17676 using namespace internal;
17678 std::stringstream sstr;
17679 sstr <<
"<t:NoEndRecurrence>" 17680 <<
"<t:StartDate>" << start_date_.to_string() <<
"</t:StartDate>" 17681 <<
"</t:NoEndRecurrence>";
17685 rapidxml::xml_node<>&
17686 to_xml_element_impl(rapidxml::xml_node<>& parent)
const override 17688 using namespace internal;
17689 check(parent.document(),
"Parent node needs to be part of a document");
17691 auto& pattern_node = create_node(parent,
"t:NoEndRecurrence");
17692 create_node(pattern_node,
"t:StartDate", start_date_.to_string());
17693 return pattern_node;
17697 #if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 17698 defined(EWS_HAS_CXX17_STATIC_ASSERT) 17699 static_assert(!std::is_default_constructible<no_end_recurrence_range>::value);
17700 static_assert(!std::is_copy_constructible<no_end_recurrence_range>::value);
17701 static_assert(!std::is_copy_assignable<no_end_recurrence_range>::value);
17702 static_assert(!std::is_move_constructible<no_end_recurrence_range>::value);
17703 static_assert(!std::is_move_assignable<no_end_recurrence_range>::value);
17711 : start_date_(std::move(start_date)), end_date_(std::move(end_date))
17715 std::string get_reccurence_range_name()
override {
return "end_date_recurrence_range"; }
17717 const date_time& get_start_date()
const EWS_NOEXCEPT {
return start_date_; }
17719 const date_time& get_end_date()
const EWS_NOEXCEPT {
return end_date_; }
17725 std::string to_xml_impl()
const override 17727 using namespace internal;
17729 std::stringstream sstr;
17730 sstr <<
"<t:EndDateRecurrence>" 17731 <<
"<t:StartDate>" << start_date_.to_string() <<
"</t:StartDate>" 17732 <<
"<t:EndDate>" << end_date_.to_string() <<
"</t:EndDate>" 17733 <<
"</t:EndDateRecurrence>";
17737 rapidxml::xml_node<>&
17738 to_xml_element_impl(rapidxml::xml_node<>& parent)
const override 17740 using internal::create_node;
17741 check(parent.document(),
"Parent node needs to be part of a document");
17743 auto& pattern_node = create_node(parent,
"t:EndDateRecurrence");
17744 create_node(pattern_node,
"t:StartDate", start_date_.to_string());
17745 create_node(pattern_node,
"t:EndDate", end_date_.to_string());
17746 return pattern_node;
17750 #if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 17751 defined(EWS_HAS_CXX17_STATIC_ASSERT) 17752 static_assert(!std::is_default_constructible<end_date_recurrence_range>::value);
17753 static_assert(!std::is_copy_constructible<end_date_recurrence_range>::value);
17754 static_assert(!std::is_copy_assignable<end_date_recurrence_range>::value);
17755 static_assert(!std::is_move_constructible<end_date_recurrence_range>::value);
17756 static_assert(!std::is_move_assignable<end_date_recurrence_range>::value);
17764 : start_date_(std::move(start_date)),
17765 no_of_occurrences_(no_of_occurrences)
17769 std::string get_reccurence_range_name()
override {
return "numbered_recurrence_range"; }
17771 const date_time& get_start_date()
const EWS_NOEXCEPT {
return start_date_; }
17773 uint32_t get_number_of_occurrences()
const EWS_NOEXCEPT
17775 return no_of_occurrences_;
17780 uint32_t no_of_occurrences_;
17782 std::string to_xml_impl()
const override 17784 using namespace internal;
17786 std::stringstream sstr;
17787 sstr <<
"<t:NumberedRecurrence>" 17788 <<
"<t:StartDate>" << start_date_.to_string() <<
"</t:StartDate>" 17789 <<
"<t:NumberOfOccurrences>" << no_of_occurrences_
17790 <<
"</t:NumberOfOccurrences>" 17791 <<
"</t:NumberedRecurrence>";
17795 rapidxml::xml_node<>&
17796 to_xml_element_impl(rapidxml::xml_node<>& parent)
const override 17798 using namespace internal;
17799 check(parent.document(),
"Parent node needs to be part of a document");
17801 auto& pattern_node = create_node(parent,
"t:NumberedRecurrence");
17802 create_node(pattern_node,
"t:StartDate", start_date_.to_string());
17803 create_node(pattern_node,
"t:NumberOfOccurrences",
17804 std::to_string(no_of_occurrences_));
17805 return pattern_node;
17809 #if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 17810 defined(EWS_HAS_CXX17_STATIC_ASSERT) 17811 static_assert(!std::is_default_constructible<numbered_recurrence_range>::value);
17812 static_assert(!std::is_copy_constructible<numbered_recurrence_range>::value);
17813 static_assert(!std::is_copy_assignable<numbered_recurrence_range>::value);
17814 static_assert(!std::is_move_constructible<numbered_recurrence_range>::value);
17815 static_assert(!std::is_move_assignable<numbered_recurrence_range>::value);
17822 #ifdef EWS_HAS_DEFAULT_AND_DELETE 17831 #ifndef EWS_DOXYGEN_SHOULD_SKIP_THIS 17833 :
item(std::move(
id), std::move(properties))
17841 return date_time(xml().get_value_as_string(
"Start"));
17847 xml().set_or_update(
"Start", datetime.to_string());
17853 return date_time(xml().get_value_as_string(
"End"));
17859 xml().set_or_update(
"End", datetime.to_string());
17867 return date_time(xml().get_value_as_string(
"OriginalStart"));
17873 return xml().get_value_as_string(
"IsAllDayEvent") ==
"true";
17879 xml().set_or_update(
"IsAllDayEvent", enabled ?
"true" :
"false");
17885 const auto val = xml().get_value_as_string(
"LegacyFreeBusyStatus");
17887 if (val.empty() || val ==
"Busy")
17891 if (val ==
"Tentative")
17903 if (val ==
"NoData")
17907 if (val ==
"WorkingElsewhere")
17911 throw exception(
"Unexpected <LegacyFreeBusyStatus>");
17917 xml().set_or_update(
"LegacyFreeBusyStatus",
17918 internal::enum_to_str(status));
17925 return xml().get_value_as_string(
"Location");
17932 xml().set_or_update(
"Location", location);
17936 std::string
get_when()
const {
return xml().get_value_as_string(
"When"); }
17941 xml().set_or_update(
"When", desc);
17949 return xml().get_value_as_string(
"IsMeeting") ==
"true";
17958 return xml().get_value_as_string(
"IsCancelled") ==
"true";
17968 return xml().get_value_as_string(
"IsRecurring") ==
"true";
17977 return xml().get_value_as_string(
"MeetingRequestWasSent") ==
"true";
17985 return xml().get_value_as_string(
"IsResponseRequested") ==
"true";
17993 const auto val = xml().get_value_as_string(
"CalendarItemType");
17995 if (val.empty() || val ==
"Single")
17999 if (val ==
"Occurrence")
18003 if (val ==
"Exception")
18007 if (val ==
"RecurringMaster")
18011 throw exception(
"Unexpected <CalendarItemType>");
18020 const auto val = xml().get_value_as_string(
"MyResponseType");
18025 return internal::str_to_response_type(val);
18034 const auto organizer = xml().get_node(
"Organizer");
18045 return get_attendees_helper(
"RequiredAttendees");
18051 set_attendees_helper(
"RequiredAttendees", attendees);
18057 return get_attendees_helper(
"OptionalAttendees");
18063 set_attendees_helper(
"OptionalAttendees", attendees);
18069 return get_attendees_helper(
"Resources");
18075 set_attendees_helper(
"Resources", resources);
18087 const auto val = xml().get_value_as_string(
"ConflictingMeetingCount");
18088 return val.empty() ? 0 : std::stoi(val);
18100 const auto val = xml().get_value_as_string(
"AdjacentMeetingCount");
18101 return val.empty() ? 0 : std::stoi(val);
18113 return duration(xml().get_value_as_string(
"Duration"));
18131 return xml().get_value_as_string(
"TimeZone");
18140 return date_time(xml().get_value_as_string(
"AppointmentReplyTime"));
18148 const auto val = xml().get_value_as_string(
"AppointmentSequenceNumber");
18149 return val.empty() ? 0 : std::stoi(val);
18167 const auto val = xml().get_value_as_string(
"AppointmentState");
18168 return val.empty() ? 0 : std::stoi(val);
18176 std::pair<std::unique_ptr<recurrence_pattern>,
18177 std::unique_ptr<recurrence_range>>
18180 typedef std::pair<std::unique_ptr<recurrence_pattern>,
18181 std::unique_ptr<recurrence_range>>
18183 auto node = xml().get_node(
"Recurrence");
18186 return return_type();
18196 auto doc = xml().document();
18197 auto recurrence_node = xml().get_node(
"Recurrence");
18198 if (recurrence_node)
18201 doc->remove_node(recurrence_node);
18204 recurrence_node = &internal::create_node(*doc,
"t:Recurrence");
18213 auto node = xml().get_node(
"FirstOccurrence");
18224 auto node = xml().get_node(
"LastOccurrence");
18235 auto node = xml().get_node(
"ModifiedOccurrences");
18238 return std::vector<occurrence_info>();
18241 auto occurrences = std::vector<occurrence_info>();
18245 occurrences.emplace_back(
18248 return occurrences;
18254 auto node = xml().get_node(
"DeletedOccurrences");
18257 return std::vector<occurrence_info>();
18260 auto occurrences = std::vector<occurrence_info>();
18264 occurrences.emplace_back(
18267 return occurrences;
18273 internal::xml_subtree::attribute id_attribute = {
18274 "Id", internal::enum_to_str(tz)};
18275 std::vector<internal::xml_subtree::attribute> attributes;
18276 attributes.emplace_back(id_attribute);
18277 xml().set_or_update(
"StartTimeZone", attributes);
18283 const auto val = xml().get_value_as_string(
"StartTimeZoneId");
18285 return internal::str_to_time_zone(val);
18287 const auto node = xml().get_node(
"StartTimeZone");
18289 return time_zone::none;
18290 const auto att = node->first_attribute(
"Id");
18292 return time_zone::none;
18293 return internal::str_to_time_zone(att->value());
18299 internal::xml_subtree::attribute id_attribute = {
18300 "Id", internal::enum_to_str(tz)};
18301 std::vector<internal::xml_subtree::attribute> attributes;
18302 attributes.emplace_back(id_attribute);
18303 xml().set_or_update(
"EndTimeZone", attributes);
18309 const auto val = xml().get_value_as_string(
"EndTimeZoneId");
18311 return internal::str_to_time_zone(val);
18313 const auto node = xml().get_node(
"EndTimeZone");
18315 return time_zone::none;
18316 const auto att = node->first_attribute(
"Id");
18318 return time_zone::none;
18319 return internal::str_to_time_zone(att->value());
18325 internal::xml_subtree::attribute id_attribute = {
18326 "Id", internal::enum_to_str(tz)};
18327 std::vector<internal::xml_subtree::attribute> attributes;
18328 attributes.emplace_back(id_attribute);
18329 xml().set_or_update(
"MeetingTimeZone", attributes);
18335 const auto val = xml().get_value_as_string(
"MeetingTimeZoneId");
18337 return internal::str_to_time_zone(val);
18339 const auto node = xml().get_node(
"MeetingTimeZone");
18341 return time_zone::none;
18342 const auto att = node->first_attribute(
"Id");
18344 return time_zone::none;
18345 return internal::str_to_time_zone(att->value());
18358 const auto val = xml().get_value_as_string(
"ConferenceType");
18359 return val.empty() ? 0 : std::stoi(val);
18368 xml().set_or_update(
"ConferenceType", std::to_string(value));
18375 return xml().get_value_as_string(
"AllowNewTimeProposal") ==
"true";
18386 xml().set_or_update(
"AllowNewTimeProposal", allowed ?
"true" :
"false");
18392 return xml().get_value_as_string(
"IsOnlineMeeting") ==
"true";
18402 xml().set_or_update(
"IsOnlineMeeting", enabled ?
"true" :
"false");
18408 return xml().get_value_as_string(
"MeetingWorkspaceUrl");
18418 xml().set_or_update(
"MeetingWorkspaceUrl", url);
18424 return xml().get_value_as_string(
"NetShowUrl");
18434 xml().set_or_update(
"NetShowUrl", url);
18441 elem.first_node_ns(internal::uri<>::microsoft::types(),
"ItemId");
18442 check(id_node,
"Expected <ItemId>");
18444 internal::xml_subtree(elem));
18448 inline std::vector<attendee>
18449 get_attendees_helper(
const char* node_name)
const 18451 const auto attendees = xml().get_node(node_name);
18454 return std::vector<attendee>();
18457 std::vector<attendee> result;
18458 for (
auto attendee_node = attendees->first_node(); attendee_node;
18459 attendee_node = attendee_node->next_sibling())
18467 set_attendees_helper(
const char* node_name,
18468 const std::vector<attendee>& attendees)
const 18470 auto doc = xml().document();
18472 auto attendees_node = xml().get_node(node_name);
18473 if (attendees_node)
18475 doc->remove_node(attendees_node);
18479 &internal::create_node(*doc,
"t:" + std::string(node_name));
18481 for (
const auto& a : attendees)
18483 a.to_xml_element(*attendees_node);
18489 const std::string& item_tag_name()
const EWS_NOEXCEPT
18491 static const std::string name(
"CalendarItem");
18496 #if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 18497 defined(EWS_HAS_CXX17_STATIC_ASSERT) 18498 static_assert(std::is_default_constructible<calendar_item>::value);
18499 static_assert(std::is_copy_constructible<calendar_item>::value);
18500 static_assert(std::is_copy_assignable<calendar_item>::value);
18501 static_assert(std::is_move_constructible<calendar_item>::value);
18502 static_assert(std::is_move_assignable<calendar_item>::value);
18510 #ifdef EWS_HAS_DEFAULT_AND_DELETE 18519 #ifndef EWS_DOXYGEN_SHOULD_SKIP_THIS 18521 :
item(std::move(
id), std::move(properties))
18529 const auto sender_node = xml().get_node(
"Sender");
18540 auto doc = xml().document();
18541 auto sender_node = xml().get_node(
"Sender");
18544 doc->remove_node(sender_node);
18546 sender_node = &internal::create_node(*doc,
"t:Sender");
18553 return get_recipients_impl(
"ToRecipients");
18562 set_recipients_impl(
"ToRecipients", recipients);
18568 return get_recipients_impl(
"CcRecipients");
18578 set_recipients_impl(
"CcRecipients", recipients);
18584 return get_recipients_impl(
"BccRecipients");
18594 set_recipients_impl(
"BccRecipients", recipients);
18605 const auto from_node = xml().get_node(
"From");
18616 auto doc = xml().document();
18617 auto from_node = xml().get_node(
"From");
18620 doc->remove_node(from_node);
18622 from_node = &internal::create_node(*doc,
"t:From");
18633 return xml().get_value_as_string(
"InternetMessageId");
18647 xml().set_or_update(
"InternetMessageId", value);
18653 return xml().get_value_as_string(
"IsRead") ==
"true";
18662 xml().set_or_update(
"IsRead", value ?
"true" :
"false");
18671 return get_recipients_impl(
"ReplyTo");
18681 set_recipients_impl(
"ReplyTo", recipients);
18688 elem.first_node_ns(internal::uri<>::microsoft::types(),
"ItemId");
18689 check(id_node,
"Expected <ItemId>");
18691 internal::xml_subtree(elem));
18697 const std::string& item_tag_name()
const EWS_NOEXCEPT
18699 static const std::string name(
"Message");
18703 std::vector<mailbox> get_recipients_impl(
const char* node_name)
const 18705 const auto recipients = xml().get_node(node_name);
18708 return std::vector<mailbox>();
18710 std::vector<mailbox> result;
18711 for (
auto mailbox_node = recipients->first_node(); mailbox_node;
18712 mailbox_node = mailbox_node->next_sibling())
18719 void set_recipients_impl(
const char* node_name,
18720 const std::vector<mailbox>& recipients)
18722 auto doc = xml().document();
18724 auto recipients_node = xml().get_node(node_name);
18725 if (recipients_node)
18727 doc->remove_node(recipients_node);
18731 &internal::create_node(*doc, std::string(
"t:") + node_name);
18733 for (
const auto& recipient : recipients)
18735 recipient.to_xml_element(*recipients_node);
18740 #if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 18741 defined(EWS_HAS_CXX17_STATIC_ASSERT) 18742 static_assert(std::is_default_constructible<message>::value);
18743 static_assert(std::is_copy_constructible<message>::value);
18744 static_assert(std::is_copy_assignable<message>::value);
18745 static_assert(std::is_move_constructible<message>::value);
18746 static_assert(std::is_move_assignable<message>::value);
18754 property_path(
const char* uri) : uri_(uri) { class_name(); }
18756 #ifdef EWS_HAS_DEFAULT_AND_DELETE 18764 std::string to_xml()
const {
return this->to_xml_impl(); }
18766 std::string to_xml(
const std::string& value)
const 18768 return this->to_xml_impl(value);
18772 const std::string&
field_uri() const EWS_NOEXCEPT {
return uri_; }
18775 std::string class_name()
const 18778 const auto n = uri_.find(
':');
18779 check((n != std::string::npos),
"Expected a ':' in URI");
18780 const auto substr = uri_.substr(0, n);
18781 if (substr ==
"folder")
18785 else if (substr ==
"item")
18789 else if (substr ==
"message")
18793 else if (substr ==
"meeting")
18797 else if (substr ==
"meetingRequest")
18799 return "MeetingRequest";
18801 else if (substr ==
"calendar")
18803 return "CalendarItem";
18805 else if (substr ==
"task")
18809 else if (substr ==
"contacts")
18813 else if (substr ==
"distributionlist")
18815 return "DistributionList";
18817 else if (substr ==
"postitem")
18821 else if (substr ==
"conversation")
18823 return "Conversation";
18830 throw exception(
"Unknown property path");
18833 virtual std::string to_xml_impl()
const 18835 std::stringstream sstr;
18836 sstr <<
"<t:FieldURI FieldURI=\"";
18837 sstr << uri_ <<
"\"/>";
18841 virtual std::string to_xml_impl(
const std::string& value)
const 18843 std::stringstream sstr;
18844 sstr <<
"<t:FieldURI FieldURI=\"";
18845 sstr << uri_ <<
"\"/>";
18846 sstr <<
"<t:" << class_name() <<
">";
18847 sstr <<
"<t:" << property_name() <<
">";
18849 sstr <<
"</t:" << property_name() <<
">";
18850 sstr <<
"</t:" << class_name() <<
">";
18855 std::string property_name()
const 18857 const auto n = uri_.rfind(
':');
18858 check((n != std::string::npos),
"Expected a ':' in URI");
18859 return uri_.substr(n + 1);
18870 #if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 18871 defined(EWS_HAS_CXX17_STATIC_ASSERT) 18872 static_assert(!std::is_default_constructible<property_path>::value);
18873 static_assert(std::is_copy_constructible<property_path>::value);
18874 static_assert(std::is_copy_assignable<property_path>::value);
18875 static_assert(std::is_move_constructible<property_path>::value);
18876 static_assert(std::is_move_assignable<property_path>::value);
18891 std::string to_xml_impl()
const override 18893 std::stringstream sstr;
18894 sstr <<
"<t:IndexedFieldURI FieldURI=";
18895 sstr <<
"\"" << field_uri() <<
"\"";
18896 sstr <<
" FieldIndex=";
18904 std::string to_xml_impl(
const std::string& value)
const override 18906 std::stringstream sstr;
18907 sstr <<
"<t:IndexedFieldURI FieldURI=";
18908 sstr <<
"\"" << field_uri() <<
"\"";
18909 sstr <<
" FieldIndex=";
18914 sstr <<
"<t:" << class_name() <<
">";
18916 sstr <<
" </t:" << class_name() <<
">";
18920 std::string index_;
18923 #if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 18924 defined(EWS_HAS_CXX17_STATIC_ASSERT) 18925 static_assert(!std::is_default_constructible<indexed_property_path>::value);
18926 static_assert(std::is_copy_constructible<indexed_property_path>::value);
18927 static_assert(std::is_copy_assignable<indexed_property_path>::value);
18928 static_assert(std::is_move_constructible<indexed_property_path>::value);
18929 static_assert(std::is_move_assignable<indexed_property_path>::value);
18934 namespace folder_property_path
18937 static const property_path parent_folder_id =
"folder:ParentFolderId";
18938 static const property_path display_name =
"folder:DisplayName";
18939 static const property_path unread_count =
"folder:UnreadCount";
18940 static const property_path total_count =
"folder:TotalCount";
18941 static const property_path child_folder_count =
"folder:ChildFolderCount";
18942 static const property_path folder_class =
"folder:FolderClass";
18943 static const property_path search_parameters =
"folder:SearchParameters";
18945 "folder:ManagedFolderInformation";
18946 static const property_path permission_set =
"folder:PermissionSet";
18947 static const property_path effective_rights =
"folder:EffectiveRights";
18949 "folder:SharingEffectiveRights";
18952 namespace item_property_path
18955 static const property_path parent_folder_id =
"item:ParentFolderId";
18958 static const property_path attachments =
"item:Attachments";
18960 static const property_path date_time_received =
"item:DateTimeReceived";
18963 static const property_path has_attachments =
"item:HasAttachments";
18967 "item:InternetMessageHeaders";
18968 static const property_path is_associated =
"item:IsAssociated";
18972 static const property_path is_submitted =
"item:IsSubmitted";
18973 static const property_path is_unmodified =
"item:IsUnmodified";
18974 static const property_path date_time_sent =
"item:DateTimeSent";
18975 static const property_path date_time_created =
"item:DateTimeCreated";
18977 static const property_path response_objects =
"item:ResponseObjects";
18979 static const property_path reminder_due_by =
"item:ReminderDueBy";
18980 static const property_path reminder_is_set =
"item:ReminderIsSet";
18981 static const property_path reminder_next_time =
"item:ReminderNextTime";
18983 "item:ReminderMinutesBeforeStart";
18987 static const property_path effective_rights =
"item:EffectiveRights";
18988 static const property_path last_modified_name =
"item:LastModifiedName";
18989 static const property_path last_modified_time =
"item:LastModifiedTime";
18990 static const property_path conversation_id =
"item:ConversationId";
18991 static const property_path unique_body =
"item:UniqueBody";
18993 static const property_path store_entry_id =
"item:StoreEntryId";
18994 static const property_path instance_key =
"item:InstanceKey";
18995 static const property_path normalized_body =
"item:NormalizedBody";
18997 "item:EntityExtractionResult";
18999 static const property_path archive_tag =
"item:ArchiveTag";
19000 static const property_path retention_date =
"item:RetentionDate";
19003 "item:NextPredictedAction";
19004 static const property_path grouping_action =
"item:GroupingAction";
19006 "item:PredictedActionReasons";
19008 static const property_path rights_management_license_data =
19009 "item:RightsManagementLicenseData";
19010 static const property_path block_status =
"item:BlockStatus";
19011 static const property_path has_blocked_images =
"item:HasBlockedImages";
19012 static const property_path web_client_read_from_query_string =
19013 "item:WebClientReadFormQueryString";
19014 static const property_path web_client_edit_from_query_string =
19015 "item:WebClientEditFormQueryString";
19018 static const property_path mime_content_utf8 =
"item:MimeContentUTF8";
19021 namespace message_property_path
19023 static const property_path conversation_index =
"message:ConversationIndex";
19024 static const property_path conversation_topic =
"message:ConversationTopic";
19026 "message:InternetMessageId";
19029 "message:IsResponseRequested";
19031 "message:IsReadReceiptRequested";
19033 "message:IsDeliveryReceiptRequested";
19034 static const property_path received_by =
"message:ReceivedBy";
19036 "message:ReceivedRepresenting";
19037 static const property_path references =
"message:References";
19041 static const property_path to_recipients =
"message:ToRecipients";
19042 static const property_path cc_recipients =
"message:CcRecipients";
19043 static const property_path bcc_recipients =
"message:BccRecipients";
19045 "message:ApprovalRequestData";
19046 static const property_path voting_information =
"message:VotingInformation";
19048 "message:ReminderMessageData";
19051 namespace meeting_property_path
19054 "meeting:AssociatedCalendarItemId";
19055 static const property_path is_delegated =
"meeting:IsDelegated";
19056 static const property_path is_out_of_date =
"meeting:IsOutOfDate";
19057 static const property_path has_been_processed =
"meeting:HasBeenProcessed";
19059 static const property_path proposed_start =
"meeting:ProposedStart";
19060 static const property_path proposed_end =
"meeting:PropsedEnd";
19063 namespace meeting_request_property_path
19066 "meetingRequest:MeetingRequestType";
19068 "meetingRequest:IntendedFreeBusyStatus";
19070 "meetingRequest:ChangeHighlights";
19073 namespace calendar_property_path
19077 static const property_path original_start =
"calendar:OriginalStart";
19078 static const property_path start_wall_clock =
"calendar:StartWallClock";
19079 static const property_path end_wall_clock =
"calendar:EndWallClock";
19080 static const property_path start_time_zone_id =
"calendar:StartTimeZoneId";
19081 static const property_path end_time_zone_id =
"calendar:EndTimeZoneId";
19082 static const property_path is_all_day_event =
"calendar:IsAllDayEvent";
19084 "calendar:LegacyFreeBusyStatus";
19087 static const property_path is_meeting =
"calendar:IsMeeting";
19088 static const property_path is_cancelled =
"calendar:IsCancelled";
19089 static const property_path is_recurring =
"calendar:IsRecurring";
19091 "calendar:MeetingRequestWasSent";
19093 "calendar:IsResponseRequested";
19095 static const property_path my_response_type =
"calendar:MyResponseType";
19098 "calendar:RequiredAttendees";
19100 "calendar:OptionalAttendees";
19101 static const property_path resources =
"calendar:Resources";
19103 "calendar:ConflictingMeetingCount";
19105 "calendar:AdjacentMeetingCount";
19107 "calendar:ConflictingMeetings";
19108 static const property_path adjacent_meetings =
"calendar:AdjacentMeetings";
19112 "calendar:AppointmentReplyTime";
19114 "calendar:AppointmentSequenceNumber";
19115 static const property_path appointment_state =
"calendar:AppointmentState";
19116 static const property_path recurrence =
"calendar:Recurrence";
19117 static const property_path first_occurrence =
"calendar:FirstOccurrence";
19118 static const property_path last_occurrence =
"calendar:LastOccurrence";
19120 "calendar:ModifiedOccurrences";
19122 "calendar:DeletedOccurrences";
19123 static const property_path meeting_time_zone =
"calendar:MeetingTimeZone";
19124 static const property_path conference_type =
"calendar:ConferenceType";
19126 "calendar:AllowNewTimeProposal";
19127 static const property_path is_online_meeting =
"calendar:IsOnlineMeeting";
19129 "calendar:MeetingWorkspaceUrl";
19130 static const property_path net_show_url =
"calendar:NetShowUrl";
19132 static const property_path recurrence_id =
"calendar:RecurrenceId";
19133 static const property_path date_time_stamp =
"calendar:DateTimeStamp";
19134 static const property_path start_time_zone =
"calendar:StartTimeZone";
19135 static const property_path end_time_zone =
"calendar:EndTimeZone";
19137 "calendar:JoinOnlineMeetingUrl";
19139 "calendar:OnlineMeetingSettings";
19140 static const property_path is_organizer =
"calendar:IsOrganizer";
19143 namespace task_property_path
19145 static const property_path actual_work =
"task:ActualWork";
19146 static const property_path assigned_time =
"task:AssignedTime";
19147 static const property_path billing_information =
"task:BillingInformation";
19148 static const property_path change_count =
"task:ChangeCount";
19150 static const property_path complete_date =
"task:CompleteDate";
19156 "task:IsAssignmentEditable";
19157 static const property_path is_complete =
"task:IsComplete";
19158 static const property_path is_recurring =
"task:IsRecurring";
19159 static const property_path is_team_task =
"task:IsTeamTask";
19162 static const property_path percent_complete =
"task:PercentComplete";
19166 static const property_path status_description =
"task:StatusDescription";
19170 namespace contact_property_path
19173 static const property_path assistant_name =
"contacts:AssistantName";
19175 static const property_path business_home_page =
"contacts:BusinessHomePage";
19177 static const property_path companies =
"contacts:Companies";
19178 static const property_path company_name =
"contacts:CompanyName";
19180 static const property_path contact_source =
"contacts:ContactSource";
19182 static const property_path department =
"contacts:Department";
19183 static const property_path display_name =
"contacts:DisplayName";
19185 static const property_path direct_reports =
"contacts:DirectReports";
19186 static const property_path email_addresses =
"contacts:EmailAddresses";
19195 static const property_path file_as_mapping =
"contacts:FileAsMapping";
19196 static const property_path generation =
"contacts:Generation";
19197 static const property_path given_name =
"contacts:GivenName";
19198 static const property_path im_addresses =
"contacts:ImAddresses";
19207 static const property_path job_title =
"contacts:JobTitle";
19209 static const property_path manager_mailbox =
"contacts:ManagerMailbox";
19210 static const property_path middle_name =
"contacts:MiddleName";
19213 "contacts:MSExchangeCertificate";
19216 static const property_path office_location =
"contacts:OfficeLocation";
19217 static const property_path phone_numbers =
"contacts:PhoneNumbers";
19222 assistant_phone(
"contacts:PhoneNumber",
"AssistantPhone");
19226 business_phone(
"contacts:PhoneNumber",
"BusinessPhone");
19228 business_phone_2(
"contacts:PhoneNumber",
"BusinessPhone2");
19234 company_main_phone(
"contacts:PhoneNumber",
"CompanyMainPhone");
19248 other_telephone(
"contacts:PhoneNumber",
"OtherTelephone");
19261 static const property_path phonetic_full_name =
"contacts:PhoneticFullName";
19263 "contacts:PhoneticFirstName";
19264 static const property_path phonetic_last_name =
"contacts:PhoneticLastName";
19267 "contacts:PhysicalAddresses";
19274 street(
"contacts:PhysicalAddress:Street",
"Business");
19276 city(
"contacts:PhysicalAddress:City",
"Business");
19278 state(
"contacts:PhysicalAddress:State",
"Business");
19280 country_or_region(
"contacts:PhysicalAddress:CountryOrRegion",
19283 postal_code(
"contacts:PhysicalAddress:PostalCode",
"Business");
19288 street(
"contacts:PhysicalAddress:Street",
"Home");
19290 city(
"contacts:PhysicalAddress:City",
"Home");
19292 state(
"contacts:PhysicalAddress:State",
"Home");
19294 country_or_region(
"contacts:PhysicalAddress:CountryOrRegion",
19297 postal_code(
"contacts:PhysicalAddress:PostalCode",
"Home");
19302 street(
"contacts:PhysicalAddress:Street",
"Other");
19304 city(
"contacts:PhysicalAddress:City",
"Other");
19306 state(
"contacts:PhysicalAddress:State",
"Other");
19308 country_or_region(
"contacts:PhysicalAddress:CountryOrRegion",
19311 postal_code(
"contacts:PhysicalAddress:PostalCode",
"Other");
19316 "contacts:PostalAddressIndex";
19317 static const property_path profession =
"contacts:Profession";
19318 static const property_path spouse_name =
"contacts:SpouseName";
19321 "contacts:WeddingAnniversary";
19323 "contacts:UserSMIMECertificate";
19324 static const property_path has_picture =
"contacts:HasPicture";
19327 namespace distribution_list_property_path
19329 static const property_path members =
"distributionlist:Members";
19332 namespace post_item_property_path
19334 static const property_path posted_time =
"postitem:PostedTime";
19337 namespace conversation_property_path
19339 static const property_path conversation_id =
"conversation:ConversationId";
19341 "conversation:ConversationTopic";
19343 "conversation:UniqueRecipients";
19345 "conversation:GlobalUniqueRecipients";
19347 "conversation:UniqueUnreadSenders";
19349 "conversation:GlobalUniqueUnreadSenders";
19350 static const property_path unique_senders =
"conversation:UniqueSenders";
19352 "conversation:GlobalUniqueSenders";
19354 "conversation:LastDeliveryTime";
19356 "conversation:GlobalLastDeliveryTime";
19357 static const property_path categories =
"conversation:Categories";
19359 "conversation:GlobalCategories";
19360 static const property_path flag_status =
"conversation:FlagStatus";
19362 "conversation:GlobalFlagStatus";
19363 static const property_path has_attachments =
"conversation:HasAttachments";
19365 "conversation:GlobalHasAttachments";
19366 static const property_path has_irm =
"conversation:HasIrm";
19367 static const property_path global_has_irm =
"conversation:GlobalHasIrm";
19368 static const property_path message_count =
"conversation:MessageCount";
19370 "conversation:GlobalMessageCount";
19371 static const property_path unread_count =
"conversation:UnreadCount";
19373 "conversation:GlobalUnreadCount";
19375 static const property_path global_size =
"conversation:GlobalSize";
19376 static const property_path item_classes =
"conversation:ItemClasses";
19378 "conversation:GlobalItemClasses";
19381 "conversation:GlobalImportance";
19382 static const property_path item_ids =
"conversation:ItemIds";
19383 static const property_path global_item_ids =
"conversation:GlobalItemIds";
19385 "conversation:LastModifiedTime";
19386 static const property_path instance_key =
"conversation:InstanceKey";
19387 static const property_path preview =
"conversation:Preview";
19389 "conversation:GlobalParentFolderId";
19391 "conversation:NextPredictedAction";
19392 static const property_path grouping_action =
"conversation:GroupingAction";
19393 static const property_path icon_index =
"conversation:IconIndex";
19395 "conversation:GlobalIconIndex";
19396 static const property_path draft_item_ids =
"conversation:DraftItemIds";
19397 static const property_path has_clutter =
"conversation:HasClutter";
19418 : value_(path.to_xml(internal::escape(value)))
19423 : value_(path.to_xml(internal::escape(value)))
19428 : value_(path.to_xml(std::to_string(value)))
19433 : value_(path.to_xml(std::to_string(value)))
19438 : value_(path.to_xml(std::to_string(value)))
19443 : value_(path.to_xml(std::to_string(value)))
19448 : value_(path.to_xml(std::to_string(value)))
19453 : value_(path.to_xml(std::to_string(value)))
19458 : value_(path.to_xml(std::to_string(value)))
19463 : value_(path.to_xml(std::to_string(value)))
19468 : value_(path.to_xml(std::to_string(value)))
19473 : value_(path.to_xml((value ?
"true" :
"false")))
19477 #ifdef EWS_HAS_DEFAULT_TEMPLATE_ARGS_FOR_FUNCTIONS 19478 template <
typename T,
19479 typename =
typename std::enable_if<std::is_enum<T>::value>::type>
19481 : value_(path.to_xml(internal::enum_to_str(enum_value)))
19486 : value_(path.to_xml(internal::enum_to_str(enum_value)))
19491 : value_(path.to_xml(internal::enum_to_str(enum_value)))
19497 : value_(path.to_xml(value.to_xml()))
19502 : value_(path.to_xml(value.to_string()))
19507 : value_(path.to_xml(value.
to_xml()))
19515 std::stringstream sstr;
19516 sstr <<
"<t:Recurrence>" << pattern.to_xml() << range.to_xml()
19517 <<
"</t:Recurrence>";
19518 value_ = path.to_xml(sstr.str());
19521 template <
typename T>
19522 property(
property_path path,
const std::vector<T>& value) : value_()
19524 std::stringstream sstr;
19525 for (
const auto& elem : value)
19527 sstr << elem.to_xml();
19529 value_ = path.to_xml(sstr.str());
19532 property(
property_path path,
const std::vector<std::string>& value)
19535 std::stringstream sstr;
19536 for (
const auto& str : value)
19538 sstr <<
"<t:String>" << str <<
"</t:String>";
19540 value_ = path.to_xml(sstr.str());
19544 : value_(path.to_xml(address.to_xml()))
19549 : value_(path.to_xml(address.to_xml()))
19554 : value_(path.to_xml(address.to_xml()))
19559 : value_(path.to_xml(number.to_xml()))
19563 const std::string& to_xml()
const EWS_NOEXCEPT {
return value_; }
19566 std::string value_;
19569 #if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 19570 defined(EWS_HAS_CXX17_STATIC_ASSERT) 19571 static_assert(!std::is_default_constructible<property>::value);
19572 static_assert(std::is_copy_constructible<property>::value);
19573 static_assert(std::is_copy_assignable<property>::value);
19574 static_assert(std::is_move_constructible<property>::value);
19575 static_assert(std::is_move_assignable<property>::value);
19584 filter_html_content_(
false), include_mime_content_(
false),
19585 convert_html_code_page_to_utf8_(
true)
19591 filter_html_content_(
false), include_mime_content_(
false),
19592 convert_html_code_page_to_utf8_(
true)
19597 std::vector<extended_field_uri>&& extended_field_uris)
19599 extended_field_uris_(std::move(extended_field_uris)),
19600 filter_html_content_(
false), include_mime_content_(
false),
19601 convert_html_code_page_to_utf8_(
true)
19605 explicit item_shape(std::vector<property_path>&& additional_properties)
19607 additional_properties_(std::move(additional_properties)),
19608 filter_html_content_(
false), include_mime_content_(
false),
19609 convert_html_code_page_to_utf8_(
true)
19613 explicit item_shape(std::vector<extended_field_uri>&& extended_field_uris)
19615 extended_field_uris_(std::move(extended_field_uris)),
19616 filter_html_content_(
false), include_mime_content_(
false),
19617 convert_html_code_page_to_utf8_(
true)
19621 item_shape(std::vector<property_path>&& additional_properties,
19622 std::vector<extended_field_uri>&& extended_field_uris)
19624 additional_properties_(std::move(additional_properties)),
19625 extended_field_uris_(std::move(extended_field_uris)),
19626 filter_html_content_(
false), include_mime_content_(
false),
19627 convert_html_code_page_to_utf8_(
true)
19631 std::string to_xml()
const 19633 std::stringstream sstr;
19635 sstr <<
"<m:ItemShape>" 19638 sstr << internal::enum_to_str(base_shape_);
19639 sstr <<
"</t:BaseShape>" 19642 sstr << internal::body_type_str(body_type_);
19643 sstr <<
"</t:BodyType>" 19645 "<t:AdditionalProperties>";
19646 for (
const auto& prop : additional_properties_)
19648 sstr << prop.to_xml();
19650 for (
auto field : extended_field_uris_)
19652 sstr << field.to_xml();
19654 sstr <<
"</t:AdditionalProperties>" 19656 "<t:FilterHtmlContent>";
19657 sstr << (filter_html_content_ ?
"true" :
"false");
19658 sstr <<
"</t:FilterHtmlContent>" 19660 "<t:IncludeMimeContent>";
19661 sstr << (include_mime_content_ ?
"true" :
"false");
19662 sstr <<
"</t:IncludeMimeContent>" 19664 "<t:ConvertHtmlCodePageToUTF8>";
19665 sstr << (convert_html_code_page_to_utf8_ ?
"true" :
"false");
19666 sstr <<
"</t:ConvertHtmlCodePageToUTF8>" 19673 base_shape get_base_shape()
const EWS_NOEXCEPT {
return base_shape_; }
19675 body_type get_body_type()
const EWS_NOEXCEPT {
return body_type_; }
19677 const std::vector<property_path>&
19678 get_additional_properties()
const EWS_NOEXCEPT
19680 return additional_properties_;
19683 const std::vector<extended_field_uri>&
19684 get_extended_field_uris()
const EWS_NOEXCEPT
19686 return extended_field_uris_;
19689 bool has_filter_html_content()
const EWS_NOEXCEPT
19691 return filter_html_content_;
19694 bool has_include_mime_content()
const EWS_NOEXCEPT
19696 return include_mime_content_;
19699 bool has_convert_html_code_page_to_utf8()
const EWS_NOEXCEPT
19701 return convert_html_code_page_to_utf8_;
19708 void set_filter_html_content(
bool filter_html_content)
19710 filter_html_content_ = filter_html_content;
19713 void set_include_mime_content(
bool include_mime_content)
19715 include_mime_content_ = include_mime_content;
19719 set_convert_html_code_page_to_utf8_(
bool convert_html_code_page_to_utf8)
19721 convert_html_code_page_to_utf8_ = convert_html_code_page_to_utf8;
19725 base_shape base_shape_;
19726 body_type body_type_;
19727 std::vector<property_path> additional_properties_;
19728 std::vector<extended_field_uri> extended_field_uris_;
19729 bool filter_html_content_;
19730 bool include_mime_content_;
19731 bool convert_html_code_page_to_utf8_;
19734 #if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 19735 defined(EWS_HAS_CXX17_STATIC_ASSERT) 19736 static_assert(std::is_default_constructible<item_shape>::value);
19737 static_assert(std::is_copy_constructible<item_shape>::value);
19738 static_assert(std::is_copy_assignable<item_shape>::value);
19739 static_assert(std::is_move_constructible<item_shape>::value);
19740 static_assert(std::is_move_assignable<item_shape>::value);
19765 #ifdef EWS_HAS_DEFAULT_AND_DELETE 19769 std::string to_xml()
const {
return func_(); }
19773 : func_(std::move(func))
19779 : func_([=]() -> std::string {
19780 std::stringstream sstr;
19782 sstr <<
"<t:" << term <<
">";
19783 sstr << path.to_xml();
19784 sstr <<
"<t:FieldURIOrConstant>";
19785 sstr <<
"<t:Constant Value=\"";
19786 sstr << std::boolalpha << b;
19787 sstr <<
"\"/></t:FieldURIOrConstant></t:";
19788 sstr << term <<
">";
19795 : func_([=]() -> std::string {
19796 std::stringstream sstr;
19798 sstr <<
"<t:" << term <<
">";
19799 sstr << path.to_xml();
19801 <<
"FieldURIOrConstant>";
19802 sstr <<
"<t:Constant Value=\"";
19803 sstr << std::to_string(i);
19804 sstr <<
"\"/></t:FieldURIOrConstant></t:";
19805 sstr << term <<
">";
19812 : func_([=]() -> std::string {
19813 std::stringstream sstr;
19815 sstr <<
"<t:" << term <<
">";
19816 sstr << path.to_xml();
19818 <<
"FieldURIOrConstant>";
19819 sstr <<
"<t:Constant Value=\"";
19821 sstr <<
"\"/></t:FieldURIOrConstant></t:";
19822 sstr << term <<
">";
19830 : func_([=]() -> std::string {
19831 std::stringstream sstr;
19833 sstr <<
"<t:" << term <<
">";
19834 sstr << path.to_xml();
19835 sstr <<
"<t:FieldURIOrConstant>";
19836 sstr <<
"<t:Constant Value=\"";
19838 sstr <<
"\"/></t:FieldURIOrConstant></t:";
19839 sstr << term <<
">";
19846 : func_([=]() -> std::string {
19847 std::stringstream sstr;
19849 sstr <<
"<t:" << term <<
">";
19850 sstr << path.to_xml();
19851 sstr <<
"<t:FieldURIOrConstant>";
19852 sstr <<
"<t:Constant Value=\"";
19853 sstr << when.to_string();
19854 sstr <<
"\"/></t:FieldURIOrConstant></t:";
19855 sstr << term <<
">";
19862 std::function<std::string()> func_;
19865 #if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 19866 defined(EWS_HAS_CXX17_STATIC_ASSERT) 19867 static_assert(!std::is_default_constructible<search_expression>::value);
19868 static_assert(std::is_copy_constructible<search_expression>::value);
19869 static_assert(std::is_copy_assignable<search_expression>::value);
19870 static_assert(std::is_move_constructible<search_expression>::value);
19871 static_assert(std::is_move_assignable<search_expression>::value);
19909 #if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 19910 defined(EWS_HAS_CXX17_STATIC_ASSERT) 19911 static_assert(!std::is_default_constructible<is_equal_to>::value);
19912 static_assert(std::is_copy_constructible<is_equal_to>::value);
19913 static_assert(std::is_copy_assignable<is_equal_to>::value);
19914 static_assert(std::is_move_constructible<is_equal_to>::value);
19915 static_assert(std::is_move_assignable<is_equal_to>::value);
19951 #if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 19952 defined(EWS_HAS_CXX17_STATIC_ASSERT) 19953 static_assert(!std::is_default_constructible<is_not_equal_to>::value);
19954 static_assert(std::is_copy_constructible<is_not_equal_to>::value);
19955 static_assert(std::is_copy_assignable<is_not_equal_to>::value);
19956 static_assert(std::is_move_constructible<is_not_equal_to>::value);
19957 static_assert(std::is_move_assignable<is_not_equal_to>::value);
19990 #if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 19991 defined(EWS_HAS_CXX17_STATIC_ASSERT) 19992 static_assert(!std::is_default_constructible<is_greater_than>::value);
19993 static_assert(std::is_copy_constructible<is_greater_than>::value);
19994 static_assert(std::is_copy_assignable<is_greater_than>::value);
19995 static_assert(std::is_move_constructible<is_greater_than>::value);
19996 static_assert(std::is_move_assignable<is_greater_than>::value);
20030 #if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 20031 defined(EWS_HAS_CXX17_STATIC_ASSERT) 20033 !std::is_default_constructible<is_greater_than_or_equal_to>::value);
20034 static_assert(std::is_copy_constructible<is_greater_than_or_equal_to>::value);
20035 static_assert(std::is_copy_assignable<is_greater_than_or_equal_to>::value);
20036 static_assert(std::is_move_constructible<is_greater_than_or_equal_to>::value);
20037 static_assert(std::is_move_assignable<is_greater_than_or_equal_to>::value);
20070 #if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 20071 defined(EWS_HAS_CXX17_STATIC_ASSERT) 20072 static_assert(!std::is_default_constructible<is_less_than>::value);
20073 static_assert(std::is_copy_constructible<is_less_than>::value);
20074 static_assert(std::is_copy_assignable<is_less_than>::value);
20075 static_assert(std::is_move_constructible<is_less_than>::value);
20076 static_assert(std::is_move_assignable<is_less_than>::value);
20110 #if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 20111 defined(EWS_HAS_CXX17_STATIC_ASSERT) 20112 static_assert(!std::is_default_constructible<is_less_than_or_equal_to>::value);
20113 static_assert(std::is_copy_constructible<is_less_than_or_equal_to>::value);
20114 static_assert(std::is_copy_assignable<is_less_than_or_equal_to>::value);
20115 static_assert(std::is_move_constructible<is_less_than_or_equal_to>::value);
20116 static_assert(std::is_move_assignable<is_less_than_or_equal_to>::value);
20126 std::stringstream sstr;
20130 sstr << first.to_xml();
20131 sstr << second.to_xml();
20132 sstr <<
"</t:And>";
20139 #if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 20140 defined(EWS_HAS_CXX17_STATIC_ASSERT) 20141 static_assert(!std::is_default_constructible<and_>::value);
20142 static_assert(std::is_copy_constructible<and_>::value);
20143 static_assert(std::is_copy_assignable<and_>::value);
20144 static_assert(std::is_move_constructible<and_>::value);
20145 static_assert(std::is_move_assignable<and_>::value);
20155 std::stringstream sstr;
20159 sstr << first.to_xml();
20160 sstr << second.to_xml();
20168 #if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 20169 defined(EWS_HAS_CXX17_STATIC_ASSERT) 20170 static_assert(!std::is_default_constructible<or_>::value);
20171 static_assert(std::is_copy_constructible<or_>::value);
20172 static_assert(std::is_copy_assignable<or_>::value);
20173 static_assert(std::is_move_constructible<or_>::value);
20174 static_assert(std::is_move_assignable<or_>::value);
20183 std::stringstream sstr;
20187 sstr << expr.to_xml();
20188 sstr <<
"</t:Not>";
20195 #if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 20196 defined(EWS_HAS_CXX17_STATIC_ASSERT) 20197 static_assert(!std::is_default_constructible<not_>::value);
20198 static_assert(std::is_copy_constructible<not_>::value);
20199 static_assert(std::is_copy_assignable<not_>::value);
20200 static_assert(std::is_move_constructible<not_>::value);
20201 static_assert(std::is_move_assignable<not_>::value);
20238 return "FullString";
20242 return "Substring";
20244 return "PrefixOnWords";
20246 return "ExactPhrase";
20282 return "IgnoreCase";
20284 return "IgnoreNonSpacingCharacters";
20303 std::stringstream sstr;
20305 sstr <<
"<t:Contains ";
20306 sstr <<
"ContainmentMode=\"" << internal::enum_to_str(mode)
20308 sstr <<
"ContainmentComparison=\"" 20309 << internal::enum_to_str(comparison) <<
"\">";
20310 sstr << path.to_xml();
20311 sstr <<
"<t:Constant Value=\"";
20313 sstr <<
"\"/></t:Contains>";
20320 #if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 20321 defined(EWS_HAS_CXX17_STATIC_ASSERT) 20322 static_assert(!std::is_default_constructible<contains>::value);
20323 static_assert(std::is_copy_constructible<contains>::value);
20324 static_assert(std::is_copy_assignable<contains>::value);
20325 static_assert(std::is_move_constructible<contains>::value);
20326 static_assert(std::is_move_assignable<contains>::value);
20336 : max_entries_returned_(1000), offset_(0),
20342 : max_entries_returned_(max_entries_returned), offset_(0),
20347 paging_view(uint32_t max_entries_returned, uint32_t offset)
20348 : max_entries_returned_(max_entries_returned), offset_(offset),
20353 paging_view(uint32_t max_entries_returned, uint32_t offset,
20355 : max_entries_returned_(max_entries_returned), offset_(offset),
20356 base_point_(base_point)
20360 uint32_t get_max_entries_returned()
const EWS_NOEXCEPT
20362 return max_entries_returned_;
20365 uint32_t get_offset()
const EWS_NOEXCEPT {
return offset_; }
20367 std::string to_xml()
const 20369 return "<m:IndexedPageItemView MaxEntriesReturned=\"" +
20370 std::to_string(max_entries_returned_) +
"\" Offset=\"" +
20371 std::to_string(offset_) +
"\" BasePoint=\"" +
20372 internal::enum_to_str(base_point_) +
"\" />";
20375 void advance() { offset_ += max_entries_returned_; }
20378 uint32_t max_entries_returned_;
20383 #if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 20384 defined(EWS_HAS_CXX17_STATIC_ASSERT) 20385 static_assert(std::is_default_constructible<paging_view>::value);
20386 static_assert(std::is_copy_constructible<paging_view>::value);
20387 static_assert(std::is_copy_assignable<paging_view>::value);
20388 static_assert(std::is_move_constructible<paging_view>::value);
20389 static_assert(std::is_move_assignable<paging_view>::value);
20400 : start_date_(std::move(start_date)), end_date_(std::move(end_date)),
20401 max_entries_returned_(0U), max_entries_set_(
false)
20406 uint32_t max_entries_returned)
20407 : start_date_(std::move(start_date)), end_date_(std::move(end_date)),
20408 max_entries_returned_(max_entries_returned), max_entries_set_(
true)
20412 uint32_t get_max_entries_returned()
const EWS_NOEXCEPT
20414 return max_entries_returned_;
20417 const date_time& get_start_date()
const EWS_NOEXCEPT {
return start_date_; }
20419 const date_time& get_end_date()
const EWS_NOEXCEPT {
return end_date_; }
20421 std::string to_xml()
const 20423 std::stringstream sstr;
20425 sstr <<
"<m:CalendarView ";
20426 if (max_entries_set_)
20428 sstr <<
"MaxEntriesReturned=\"" 20429 << std::to_string(max_entries_returned_) <<
"\" ";
20431 sstr <<
"StartDate=\"" << start_date_.to_string() <<
"\" EndDate=\"" 20432 << end_date_.to_string() <<
"\" />";
20439 uint32_t max_entries_returned_;
20440 bool max_entries_set_;
20443 #if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 20444 defined(EWS_HAS_CXX17_STATIC_ASSERT) 20445 static_assert(!std::is_default_constructible<calendar_view>::value);
20446 static_assert(std::is_copy_constructible<calendar_view>::value);
20447 static_assert(std::is_copy_assignable<calendar_view>::value);
20448 static_assert(std::is_move_constructible<calendar_view>::value);
20449 static_assert(std::is_move_assignable<calendar_view>::value);
20479 append_to_item_field,
20487 #ifdef EWS_HAS_DEFAULT_AND_DELETE 20493 : prop_(std::move(prop.to_xml())), op_(std::move(action))
20498 : prop_(prop.to_xml()), op_(std::move(action))
20505 std::string action =
"SetItemField";
20506 if (op_ == operation::append_to_item_field)
20508 action =
"AppendToItemField";
20510 else if (op_ == operation::delete_item_field)
20512 action =
"DeleteItemField";
20514 std::stringstream sstr;
20515 sstr <<
"<t:" << action <<
">";
20517 sstr <<
"</t:" << action <<
">";
20524 std::string action =
"SetFolderField";
20525 if (op_ == operation::append_to_item_field)
20527 action =
"AppendToFolderField";
20529 else if (op_ == operation::delete_item_field)
20531 action =
"DeleteFolderField";
20533 std::stringstream sstr;
20534 sstr <<
"<t:" << action <<
">";
20536 sstr <<
"</t:" << action <<
">";
20545 #if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 20546 defined(EWS_HAS_CXX17_STATIC_ASSERT) 20547 static_assert(!std::is_default_constructible<update>::value);
20548 static_assert(std::is_copy_constructible<update>::value);
20549 static_assert(std::is_copy_assignable<update>::value);
20550 static_assert(std::is_move_constructible<update>::value);
20551 static_assert(std::is_move_assignable<update>::value);
20562 primary_smtp_address,
20566 #ifdef EWS_HAS_DEFAULT_AND_DELETE 20574 const std::string&
to_xml() const EWS_NOEXCEPT {
return xml_; }
20580 #if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 20581 defined(EWS_HAS_CXX17_STATIC_ASSERT) 20582 static_assert(!std::is_default_constructible<connecting_sid>::value);
20583 static_assert(std::is_copy_constructible<connecting_sid>::value);
20584 static_assert(std::is_copy_assignable<connecting_sid>::value);
20585 static_assert(std::is_move_constructible<connecting_sid>::value);
20586 static_assert(std::is_move_assignable<connecting_sid>::value);
20591 inline std::string enum_to_str(connecting_sid::type type)
20595 case connecting_sid::type::principal_name:
20596 return "PrincipalName";
20597 case connecting_sid::type::sid:
20599 case connecting_sid::type::primary_smtp_address:
20600 return "PrimarySmtpAddress";
20601 case connecting_sid::type::smtp_address:
20602 return "SmtpAddress";
20604 throw exception(
"Unrecognized ConnectingSID");
20612 const auto sid = internal::enum_to_str(t);
20613 xml_ =
"<t:ConnectingSID><t:" + sid +
">" +
id +
"</t:" + sid +
20614 "></t:ConnectingSID>";
20622 allow_beast = CURLSSLOPT_ALLOW_BEAST
20623 #if LIBCURL_VERSION_NUM >= 0x072C00 20625 no_revoke = CURLSSLOPT_NO_REVOKE
20627 #if LIBCURL_VERSION_NUM >= 0x074400 20629 no_partialchain = CURLSSLOPT_NO_PARTIALCHAIN
20631 #if LIBCURL_VERSION_NUM >= 0x074600 20633 revoke_best_effort = CURLSSLOPT_REVOKE_BEST_EFFORT
20635 #if LIBCURL_VERSION_NUM >= 0x074700 20637 native_ca = CURLSSLOPT_NATIVE_CA
20644 static_cast<std::underlying_type<ssl_options>::type
>(lhs) |
20645 static_cast<std::underlying_type<ssl_options>::type
>(rhs));
20650 return static_cast<std::underlying_type<ssl_options>::type
>(lhs) ==
20651 static_cast<std::underlying_type<ssl_options>::type
>(rhs);
20656 return static_cast<std::underlying_type<ssl_options>::type
>(lhs) !=
20657 static_cast<std::underlying_type<ssl_options>::type
>(rhs);
20711 template <
typename RequestHandler =
internal::http_request>
20718 #ifdef EWS_HAS_DEFAULT_AND_DELETE 20727 const std::string& username,
const std::string& password)
20728 : request_handler_(server_uri), server_version_(
"Exchange2013_SP1"),
20729 impersonation_(), time_zone_(
time_zone::none)
20731 request_handler_.set_method(RequestHandler::method::POST);
20732 request_handler_.set_content_type(
"text/xml; charset=utf-8");
20734 request_handler_.set_credentials(creds);
20740 const internal::credentials& creds)
20741 : request_handler_(server_uri), server_version_(
"Exchange2013_SP1"),
20742 impersonation_(), time_zone_(
time_zone::none)
20744 request_handler_.set_method(RequestHandler::method::POST);
20745 request_handler_.set_content_type(
"text/xml; charset=utf-8");
20746 request_handler_.set_credentials(creds);
20752 const internal::credentials& creds,
const std::string& cainfo,
20753 const std::string& capath,
const std::string& proxy_uri,
20754 const bool is_http_proxy_tunneling,
20755 const debug_callback& callback,
20757 : request_handler_(server_uri), server_version_(
"Exchange2013_SP1"),
20758 impersonation_(), time_zone_(
time_zone::none)
20760 if (!cainfo.empty())
20762 set_cainfo(cainfo);
20765 if (!capath.empty())
20767 set_capath(capath);
20770 if (!proxy_uri.empty())
20772 set_proxy(proxy_uri);
20775 if (is_http_proxy_tunneling)
20777 set_http_proxy_tunnel(is_http_proxy_tunneling);
20782 set_debug_callback(callback);
20786 #
if defined _WIN32 && (_MSC_VER == 1700 || _MSC_VER == 1800)
20787 static_cast<long>(ssl_opts) != static_cast<long>(ssl_options::none)
20789 ssl_opts != ssl_options::none
20793 set_ssl_options(ssl_opts);
20796 request_handler_.set_method(RequestHandler::method::POST);
20797 request_handler_.set_content_type(
"text/xml; charset=utf-8");
20798 request_handler_.set_credentials(creds);
20805 server_version_ = internal::enum_to_str(vers);
20825 request_handler_.set_timeout(d);
20832 request_handler_.set_option(CURLOPT_PROXY, url.c_str());
20838 request_handler_.set_option(CURLOPT_HTTPPROXYTUNNEL, (value ? 1L : 0L));
20841 #if LIBCURL_VERSION_NUM >= 0x073400 20842 void set_proxy_cainfo(
const std::string& path)
20846 request_handler_.set_option(CURLOPT_PROXY_CAINFO, path.c_str());
20851 void set_proxy_capath(
const std::string& path)
20853 request_handler_.set_option(CURLOPT_PROXY_CAPATH, path.c_str());
20860 request_handler_.set_option(CURLOPT_CAINFO, path.c_str());
20866 request_handler_.set_option(CURLOPT_CAPATH, path.c_str());
20872 request_handler_.set_option(CURLOPT_SSL_OPTIONS, value);
20878 debug_callback_ = callback;
20881 request_handler_.set_option(CURLOPT_VERBOSE, 1L);
20882 request_handler_.set_option(CURLOPT_DEBUGFUNCTION,
20883 curl_debug_callback);
20884 request_handler_.set_option(CURLOPT_DEBUGDATA, &debug_callback_);
20888 request_handler_.set_option(CURLOPT_VERBOSE, 0L);
20889 request_handler_.set_option(CURLOPT_DEBUGFUNCTION,
nullptr);
20890 request_handler_.set_option(CURLOPT_DEBUGDATA,
nullptr);
20896 static int curl_debug_callback(EWS_MAYBE_UNUSED CURL* handle,
20897 curl_infotype type,
char* data,
size_t size,
20900 std::stringstream output;
20904 case CURLINFO_TEXT:
20905 output <<
"== Info: ";
20906 output.write(data, size);
20908 case CURLINFO_HEADER_OUT:
20909 output <<
"=> Send header ";
20910 output.write(data, size);
20912 case CURLINFO_DATA_OUT:
20913 output <<
"=> Send data" << std::endl;
20915 case CURLINFO_SSL_DATA_OUT:
20916 output <<
"=> Send SSL data" << std::endl;
20918 case CURLINFO_HEADER_IN:
20919 output <<
"<= Recv header ";
20920 output.write(data, size);
20922 case CURLINFO_DATA_IN:
20923 output <<
"<= Recv data" << std::endl;
20925 case CURLINFO_SSL_DATA_IN:
20926 output <<
"<= Recv SSL data" << std::endl;
20929 output <<
"-- Unknown info type" << std::endl;
20935 (*
reinterpret_cast<debug_callback*
>(user_ptr))(output.str());
20946 return internal::str_to_server_version(server_version_);
20951 impersonation_.clear();
20957 impersonation_ = sid.
to_xml();
20964 std::string msg =
"<m:GetRoomLists />";
20965 auto response = request(msg);
20966 const auto response_message =
20967 internal::get_room_lists_response_message::parse(
20968 std::move(response));
20969 if (!response_message.success())
20973 return response_message.items();
20979 std::stringstream sstr;
20980 sstr <<
"<m:GetRooms>" 20983 << room_list.
value()
20984 <<
"</t:EmailAddress>" 20988 auto response = request(sstr.str());
20989 const auto response_message =
20990 internal::get_rooms_response_message::parse(std::move(response));
20991 if (!response_message.success())
20995 return response_message.items();
21002 return sync_folder_hierarchy(folder_id,
"");
21007 const std::string& sync_state)
21009 return sync_folder_hierarchy_impl(folder_id, sync_state);
21014 int max_changes_returned = 512)
21016 return sync_folder_items(folder_id,
"", max_changes_returned);
21020 const std::string& sync_state,
21021 int max_changes_returned = 512)
21023 std::vector<item_id> ignored_items;
21024 return sync_folder_items(folder_id, sync_state, ignored_items,
21025 max_changes_returned);
21029 sync_folder_items(
const folder_id& folder_id,
const std::string& sync_state,
21030 const std::vector<item_id>& ignored_items,
21031 int max_changes_returned = 512)
21033 return sync_folder_items_impl(folder_id, sync_state, ignored_items,
21034 max_changes_returned);
21045 const std::vector<property_path>& additional_properties)
21048 additional_properties);
21058 std::vector<folder>
21060 const std::vector<property_path>& additional_properties)
21063 additional_properties);
21069 return get_item_impl<task>(id, shape);
21076 return get_item_impl<task>(ids, shape);
21083 return get_item_impl<contact>(id, shape);
21090 return get_item_impl<contact>(ids, shape);
21097 return get_item_impl<calendar_item>(id, shape);
21101 std::vector<calendar_item>
21105 return get_item_impl<calendar_item>(ids, shape);
21112 const std::string request_string =
"<m:GetItem>" + shape.to_xml() +
21113 "<m:ItemIds>" +
id.to_xml() +
21117 auto response = request(request_string);
21118 const auto response_message =
21119 internal::get_item_response_message<calendar_item>::parse(
21120 std::move(response));
21121 if (!response_message.success())
21125 check(!response_message.items().empty(),
"Expected at least one item");
21126 return response_message.items().front();
21130 std::vector<calendar_item>
21134 check(!ids.empty(),
"Expected at least one item in given vector");
21136 std::stringstream sstr;
21137 sstr <<
"<m:GetItem>";
21138 sstr << shape.to_xml();
21139 sstr <<
"<m:ItemIds>";
21140 for (
const auto&
id : ids)
21142 sstr <<
id.to_xml();
21144 sstr <<
"</m:ItemIds>" 21147 auto response = request(sstr.str());
21148 const auto response_messages =
21149 internal::item_response_messages<calendar_item>::parse(
21150 std::move(response));
21151 if (!response_messages.success())
21153 throw exchange_error(response_messages.first_error_or_warning());
21155 return response_messages.items();
21162 return get_item_impl<message>(id, shape);
21169 return get_item_impl<message>(ids, shape);
21176 const std::string request_string =
"<m:DeleteFolder " 21178 internal::enum_to_str(del_type) +
21183 "</m:DeleteFolder>";
21185 auto response = request(request_string);
21186 const auto response_message =
21187 internal::delete_folder_response_message::parse(
21188 std::move(response));
21189 if (!response_message.success())
21203 using internal::delete_item_response_message;
21205 const std::string request_string =
21208 internal::enum_to_str(del_type) +
21210 "SendMeetingCancellations=\"" +
21211 internal::enum_to_str(cancellations) +
21213 "AffectedTaskOccurrences=\"" +
21214 internal::enum_to_str(affected) +
21221 auto response = request(request_string);
21222 const auto response_message =
21223 delete_item_response_message::parse(std::move(response));
21224 if (!response_message.success())
21236 delete_item(the_task.get_item_id(), del_type, affected);
21243 delete_item(the_contact.get_item_id());
21253 delete_item(the_calendar_item.get_item_id(), del_type,
21261 delete_item(the_message.get_item_id());
21283 const folder_id& parent_folder)
21285 return create_folder_impl(new_folder, parent_folder);
21295 const folder_id& parent_folder)
21297 return create_folder_impl(new_folders, parent_folder);
21305 return create_item_impl(the_task, folder_id());
21317 return create_item_impl(the_task, folder);
21325 return create_item_impl(tasks, folder_id());
21336 const folder_id&
folder)
21338 return create_item_impl(tasks, folder);
21347 return create_item_impl(the_contact, folder_id());
21359 return create_item_impl(the_contact, folder);
21368 return create_item_impl(contacts, folder_id());
21379 const folder_id&
folder)
21381 return create_item_impl(contacts, folder);
21392 send_meeting_invitations send_invitations =
21395 return create_item_impl(the_calendar_item, send_invitations,
21408 send_meeting_invitations send_invitations,
21409 const folder_id&
folder)
21411 return create_item_impl(the_calendar_item, send_invitations, folder);
21421 std::vector<item_id>
21423 send_meeting_invitations send_invitations =
21426 return create_item_impl(calendar_items, send_invitations, folder_id());
21437 std::vector<item_id>
21439 send_meeting_invitations send_invitations,
21440 const folder_id&
folder)
21442 return create_item_impl(calendar_items, send_invitations, folder);
21463 return create_item_impl(the_message, disposition, folder_id());
21478 const folder_id&
folder)
21480 return create_item_impl(the_message, disposition, folder);
21501 return create_item_impl(messages, disposition, folder_id());
21516 const folder_id&
folder)
21518 return create_item_impl(messages, disposition, folder);
21531 send_item(ids, folder_id());
21541 std::stringstream sstr;
21542 sstr <<
"<m:SendItem SaveItemToFolder=\"" << std::boolalpha
21543 << folder.
valid() <<
"\">" 21544 <<
"<m:ItemIds>" <<
id.to_xml() <<
"</m:ItemIds>";
21545 if (folder.
valid())
21547 sstr <<
"<m:SavedItemFolderId>" << folder.to_xml()
21548 <<
"</m:SavedItemFolderId>";
21550 sstr <<
"</m:SendItem>";
21552 auto response = request(sstr.str());
21554 const auto response_message =
21555 internal::send_item_response_message::parse(std::move(response));
21556 if (!response_message.success())
21569 std::stringstream sstr;
21570 sstr <<
"<m:SendItem SaveItemToFolder=\"" << std::boolalpha
21571 << folder.
valid() <<
"\">";
21572 for (
const auto&
id : ids)
21574 sstr <<
"<m:ItemIds>" <<
id.to_xml() <<
"</m:ItemIds>";
21576 if (folder.
valid())
21578 sstr <<
"<m:SavedItemFolderId>" << folder.to_xml()
21579 <<
"</m:SavedItemFolderId>";
21581 sstr <<
"</m:SendItem>";
21583 auto response = request(sstr.str());
21585 const auto response_message =
21586 internal::send_item_response_message::parse(std::move(response));
21587 if (!response_message.success())
21604 const std::string request_string =
21605 "<m:FindFolder Traversal=\"Shallow\">" 21607 "<t:BaseShape>IdOnly</t:BaseShape>" 21609 "<m:ParentFolderIds>" +
21610 parent_folder_id.to_xml() +
21611 "</m:ParentFolderIds>" 21614 auto response = request(request_string);
21615 const auto response_message =
21616 internal::find_folder_response_message::parse(std::move(response));
21617 if (!response_message.success())
21621 return response_message.items();
21624 std::vector<item_id> find_item(
const folder_id& parent_folder_id,
21627 const std::string request_string =
21628 "<m:FindItem Traversal=\"Shallow\">" 21630 "<t:BaseShape>IdOnly</t:BaseShape>" 21632 view.to_xml() +
"<m:ParentFolderIds>" + parent_folder_id.to_xml() +
21633 "</m:ParentFolderIds>" 21636 auto response = request(request_string);
21637 const auto response_message =
21638 internal::find_item_response_message::parse(std::move(response));
21639 if (!response_message.success())
21643 return response_message.items();
21646 std::vector<item_id> find_item(
const folder_id& parent_folder_id)
21649 const std::string request_string =
"<m:FindItem Traversal=\"Shallow\">" 21651 "<t:BaseShape>IdOnly</t:BaseShape>" 21653 "<m:ParentFolderIds>" +
21654 parent_folder_id.to_xml() +
21655 "</m:ParentFolderIds>" 21658 auto response = request(request_string);
21659 const auto response_message =
21660 internal::find_item_response_message::parse(std::move(response));
21661 if (!response_message.success())
21665 return response_message.items();
21674 const folder_id& parent_folder_id,
21677 const std::string request_string =
21678 "<m:FindItem Traversal=\"Shallow\">" + shape.to_xml() +
21679 view.to_xml() +
"<m:ParentFolderIds>" + parent_folder_id.to_xml() +
21680 "</m:ParentFolderIds>" 21683 auto response = request(request_string);
21684 const auto response_message =
21685 internal::find_calendar_item_response_message::parse(
21686 std::move(response));
21687 if (!response_message.success())
21691 return response_message.items();
21705 std::vector<item_id>
find_item(
const folder_id& parent_folder_id,
21709 const std::string request_string =
"<m:FindItem Traversal=\"Shallow\">" 21711 "<t:BaseShape>IdOnly</t:BaseShape>" 21713 "<m:Restriction>" +
21714 restriction.to_xml() +
21716 "<m:ParentFolderIds>" +
21717 parent_folder_id.to_xml() +
21718 "</m:ParentFolderIds>" 21721 auto response = request(request_string);
21722 const auto response_message =
21723 internal::find_item_response_message::parse(std::move(response));
21724 if (!response_message.success())
21728 return response_message.items();
21751 return update_item_impl(std::move(
id), std::move(change),
resolution,
21752 invitations_or_cancellations, folder_id());
21775 const folder_id&
folder)
21777 return update_item_impl(std::move(
id), std::move(change), resolution,
21778 invitations_or_cancellations, folder);
21796 item_id id,
const std::vector<update>& changes,
21801 return update_item_impl(std::move(
id), changes,
resolution,
21802 invitations_or_cancellations, folder_id());
21823 item_id id,
const std::vector<update>& changes,
21826 const folder_id&
folder)
21828 return update_item_impl(std::move(
id), changes, resolution,
21829 invitations_or_cancellations, folder);
21843 return update_folder_impl(std::move(folder_id), std::move(change));
21856 const std::vector<update>& changes)
21858 return update_folder_impl(std::move(folder_id), changes);
21869 return move_item_impl(std::move(item), folder);
21878 std::vector<item_id>
move_item(
const std::vector<item_id>& items,
21879 const folder_id&
folder)
21881 return move_item_impl(items, folder);
21892 return move_folder_impl(std::move(folder), target);
21902 const folder_id& target)
21904 return move_folder_impl(folders, target);
21908 std::vector<delegate_user>
21910 const std::vector<delegate_user>& delegates)
21912 std::stringstream sstr;
21913 sstr <<
"<m:AddDelegate>";
21914 sstr << mailbox.
to_xml(
"m");
21915 sstr <<
"<m:DelegateUsers>";
21916 for (
const auto& delegate : delegates)
21918 sstr << delegate.to_xml();
21920 sstr <<
"</m:DelegateUsers>";
21921 sstr <<
"</m:AddDelegate>";
21922 auto response = request(sstr.str());
21924 const auto response_message =
21925 internal::add_delegate_response_message::parse(std::move(response));
21926 if (!response_message.success())
21930 return response_message.get_delegates();
21936 bool include_permissions =
false)
21938 std::stringstream sstr;
21939 sstr <<
"<m:GetDelegate IncludePermissions=\"" 21940 << (include_permissions ?
"true" :
"false") <<
"\">";
21941 sstr << mailbox.
to_xml(
"m");
21942 sstr <<
"</m:GetDelegate>";
21943 auto response = request(sstr.str());
21945 const auto response_message =
21946 internal::get_delegate_response_message::parse(std::move(response));
21947 if (!response_message.success())
21951 return response_message.get_delegates();
21955 const std::vector<user_id>& delegates)
21957 std::stringstream sstr;
21958 sstr <<
"<m:RemoveDelegate>";
21959 sstr << mailbox.
to_xml(
"m");
21960 sstr <<
"<m:UserIds>";
21961 for (
const auto& user : delegates)
21963 sstr << user.to_xml();
21965 sstr <<
"</m:UserIds>";
21966 sstr <<
"</m:RemoveDelegate>";
21967 auto response = request(sstr.str());
21969 const auto response_message =
21970 internal::remove_delegate_response_message::parse(
21971 std::move(response));
21972 if (!response_message.success())
21987 auto response = request(
"<m:CreateAttachment>" 21988 "<m:ParentItemId Id=\"" +
21989 parent_item.
id() +
"\" ChangeKey=\"" +
21992 "<m:Attachments>" +
21995 "</m:CreateAttachment>");
21997 const auto response_message =
21998 internal::create_attachment_response_message::parse(
21999 std::move(response));
22000 if (!response_message.success())
22004 check(!response_message.attachment_ids().empty(),
22005 "Expected at least one attachment");
22006 return response_message.attachment_ids().front();
22018 std::vector<attachment_id>
22019 create_attachments(
const item& parent_item,
22020 const std::vector<attachment>& attachments)
22024 return std::vector<attachment_id>();
22030 bool include_mime_content =
false)
22032 std::stringstream sstr;
22033 sstr <<
"<m:GetAttachment>" 22034 "<m:AttachmentShape>" 22035 "<t:IncludeMimeContent>" 22036 << (include_mime_content ?
"true" :
"false")
22037 <<
"</t:IncludeMimeContent>" 22038 "</m:AttachmentShape>" 22039 "<m:AttachmentIds>" 22041 <<
"</m:AttachmentIds>" 22042 "</m:GetAttachment>";
22043 auto response = request(sstr.str());
22045 const auto response_message =
22046 internal::get_attachment_response_message::parse(
22047 std::move(response));
22048 if (!response_message.success())
22052 check(!response_message.attachments().empty(),
22053 "Expected at least one attachment to be returned");
22054 return response_message.attachments().front();
22064 auto response = request(
"<m:DeleteAttachment>" 22065 "<m:AttachmentIds>" +
22067 "</m:AttachmentIds>" 22068 "</m:DeleteAttachment>");
22069 const auto response_message =
22070 internal::delete_attachment_response_message::parse(
22071 std::move(response));
22072 if (!response_message.success())
22076 return response_message.get_root_item_id();
22092 std::vector<folder_id> v;
22093 return resolve_names_impl(unresolved_entry, v, scope);
22109 const std::vector<folder_id>& parent_folder_ids)
22111 return resolve_names_impl(unresolved_entry, parent_folder_ids, scope);
22114 #ifdef EWS_HAS_VARIANT 22115 subscription_information
22124 subscribe(
const std::vector<distinguished_folder_id>& ids,
22125 const std::vector<event_type>& types,
int timeout)
22127 return subscribe_impl(ids, types, timeout);
22135 void unsubscribe(
const std::string& subscription_id)
22137 return unsubscribe_impl(subscription_id);
22147 notification get_events(
const std::string& subscription_id,
22148 const std::string& watermark)
22150 return get_events_impl(subscription_id, watermark);
22154 RequestHandler request_handler_;
22155 debug_callback debug_callback_;
22156 std::string server_version_;
22157 std::string impersonation_;
22162 internal::http_response request(
const std::string& request_string)
22164 using internal::get_element_by_qname;
22165 using rapidxml::internal::compare;
22167 auto soap_headers = std::vector<std::string>();
22168 soap_headers.emplace_back(
"<t:RequestServerVersion Version=\"" +
22169 server_version_ +
"\"/>");
22170 if (!impersonation_.empty())
22172 soap_headers.emplace_back(
"<t:ExchangeImpersonation>" +
22174 "</t:ExchangeImpersonation>");
22176 if (time_zone_ != time_zone::none)
22178 soap_headers.emplace_back(
"<t:TimeZoneContext>" 22179 "<t:TimeZoneDefinition Id=\"" +
22180 internal::enum_to_str(time_zone_) +
22181 "\"/></t:TimeZoneContext>");
22184 auto response = internal::make_raw_soap_request(
22185 request_handler_, request_string, soap_headers);
22191 else if (response.is_soap_fault())
22193 std::unique_ptr<rapidxml::xml_document<char>> doc;
22197 doc = parse_response(std::move(response));
22201 throw soap_fault(
"The request failed for unknown reason " 22202 "(could not parse response)");
22205 auto elem = get_element_by_qname(
22206 *doc,
"ResponseCode", internal::uri<>::microsoft::errors());
22209 throw soap_fault(
"The request failed for unknown reason " 22210 "(unexpected XML in response)");
22213 if (compare(elem->value(), elem->value_size(),
22214 "ErrorSchemaValidation", 21))
22217 elem = get_element_by_qname(
22218 *doc,
"LineNumber", internal::uri<>::microsoft::types());
22219 check(elem,
"Expected <LineNumber> element in response");
22220 const auto line_number =
22221 std::stoul(std::string(elem->value(), elem->value_size()));
22223 elem = get_element_by_qname(
22224 *doc,
"LinePosition", internal::uri<>::microsoft::types());
22225 check(elem,
"Expected <LinePosition> element in response");
22226 const auto line_position =
22227 std::stoul(std::string(elem->value(), elem->value_size()));
22229 elem = get_element_by_qname(
22230 *doc,
"Violation", internal::uri<>::microsoft::types());
22231 check(elem,
"Expected <Violation> element in response");
22233 line_number, line_position,
22234 std::string(elem->value(), elem->value_size()));
22238 elem = get_element_by_qname(*doc,
"faultstring",
"");
22239 check(elem,
"Expected <faultstring> element in response");
22250 sync_folder_hierarchy_impl(
const folder_id& folder_id,
22251 const std::string& sync_state)
22253 std::stringstream sstr;
22254 sstr <<
"<m:SyncFolderHierarchy>" 22258 <<
"</t:BaseShape>" 22261 << folder_id.to_xml() <<
"</m:SyncFolderId>";
22262 if (!sync_state.empty())
22264 sstr <<
"<m:SyncState>" << sync_state <<
"</m:SyncState>";
22266 sstr <<
"</m:SyncFolderHierarchy>";
22268 auto response = request(sstr.str());
22269 const auto response_message =
22270 sync_folder_hierarchy_result::parse(std::move(response));
22271 check(!response_message.get_sync_state().empty(),
22272 "Expected at least a sync state");
22273 return response_message;
22277 const folder_id& folder_id,
const std::string& sync_state,
22278 std::vector<item_id> ignored_items,
int max_changes_returned = 512)
22280 std::stringstream sstr;
22281 sstr <<
"<m:SyncFolderItems>" 22285 <<
"</t:BaseShape>" 22288 << folder_id.to_xml() <<
"</m:SyncFolderId>";
22289 if (!sync_state.empty())
22291 sstr <<
"<m:SyncState>" << sync_state <<
"</m:SyncState>";
22293 if (!ignored_items.empty())
22295 sstr <<
"<m:Ignore>";
22296 for (
const auto& i : ignored_items)
22298 sstr << i.to_xml();
22300 sstr <<
"</m:Ignore>";
22302 sstr <<
"<m:MaxChangesReturned>" << max_changes_returned
22303 <<
"</m:MaxChangesReturned>" 22304 "</m:SyncFolderItems>";
22306 auto response = request(sstr.str());
22307 const auto response_message =
22308 sync_folder_items_result::parse(std::move(response));
22309 check(!response_message.get_sync_state().empty(),
22310 "Expected at least a sync state");
22311 return response_message;
22316 const std::string request_string =
"<m:GetFolder>" 22319 internal::enum_to_str(shape) +
22327 auto response = request(request_string);
22328 const auto response_message =
22329 internal::get_folder_response_message::parse(std::move(response));
22330 if (!response_message.success())
22334 check(!response_message.items().empty(),
"Expected at least one item");
22335 return response_message.items().front();
22339 get_folder_impl(
const folder_id&
id,
base_shape shape,
22340 const std::vector<property_path>& additional_properties)
22342 check(!additional_properties.empty(),
22343 "Expected at least one element in additional_properties");
22345 std::stringstream sstr;
22346 sstr <<
"<m:GetFolder>" 22349 << internal::enum_to_str(shape)
22350 <<
"</t:BaseShape>" 22351 "<t:AdditionalProperties>";
22352 for (
const auto& prop : additional_properties)
22354 sstr << prop.to_xml();
22356 sstr <<
"</t:AdditionalProperties>" 22360 <<
"</m:FolderIds>" 22363 auto response = request(sstr.str());
22364 const auto response_message =
22365 internal::folder_response_message::parse(std::move(response));
22366 if (!response_message.success())
22368 throw exchange_error(response_message.first_error_or_warning());
22370 check(!response_message.items().empty(),
"Expected at least one item");
22371 return response_message.items().front();
22374 std::vector<folder> get_folders_impl(
const std::vector<folder_id>& ids,
22377 check(!ids.empty(),
"Expected at least one element in given vector");
22379 std::stringstream sstr;
22380 sstr <<
"<m:GetFolder>" 22383 << internal::enum_to_str(shape)
22384 <<
"</t:BaseShape>" 22387 for (
const auto&
id : ids)
22389 sstr <<
id.to_xml();
22391 sstr <<
"</m:FolderIds>" 22394 auto response = request(sstr.str());
22395 const auto response_messages =
22396 internal::folder_response_message::parse(std::move(response));
22397 if (!response_messages.success())
22399 throw exchange_error(response_messages.first_error_or_warning());
22401 return response_messages.items();
22404 std::vector<folder>
22405 get_folders_impl(
const std::vector<folder_id>& ids,
base_shape shape,
22406 const std::vector<property_path>& additional_properties)
22408 check(!ids.empty(),
"Expected at least one element in given vector");
22409 check(!additional_properties.empty(),
22410 "Expected at least one element in additional_properties");
22412 std::stringstream sstr;
22413 sstr <<
"<m:GetFolder>" 22416 << internal::enum_to_str(shape)
22417 <<
"</t:BaseShape>" 22418 "<t:AdditionalProperties>";
22419 for (
const auto& prop : additional_properties)
22421 sstr << prop.to_xml();
22423 sstr <<
"</t:AdditionalProperties>" 22426 for (
const auto&
id : ids)
22428 sstr <<
id.to_xml();
22430 sstr <<
"</m:FolderIds>" 22433 auto response = request(sstr.str());
22434 const auto response_messages =
22435 internal::folder_response_message::parse(std::move(response));
22436 if (!response_messages.success())
22438 throw exchange_error(response_messages.first_error_or_warning());
22440 return response_messages.items();
22444 template <
typename ItemType>
22447 const std::string request_string =
"<m:GetItem>" + shape.to_xml() +
22448 "<m:ItemIds>" +
id.to_xml() +
22452 auto response = request(request_string);
22453 const auto response_message =
22454 internal::get_item_response_message<ItemType>::parse(
22455 std::move(response));
22456 if (!response_message.success())
22460 check(!response_message.items().empty(),
"Expected at least one item");
22461 return response_message.items().front();
22465 template <
typename ItemType>
22466 std::vector<ItemType> get_item_impl(
const std::vector<item_id>& ids,
22469 check(!ids.empty(),
"Expected at least one id in given vector");
22471 std::stringstream sstr;
22472 sstr <<
"<m:GetItem>";
22473 sstr << shape.to_xml();
22474 sstr <<
"<m:ItemIds>";
22475 for (
const auto&
id : ids)
22477 sstr <<
id.to_xml();
22479 sstr <<
"</m:ItemIds>" 22482 auto response = request(sstr.str());
22483 const auto response_messages =
22484 internal::item_response_messages<ItemType>::parse(
22485 std::move(response));
22486 if (!response_messages.success())
22488 throw exchange_error(response_messages.first_error_or_warning());
22490 return response_messages.items();
22494 template <
typename ItemType>
22495 item_id create_item_impl(
const ItemType& the_item,
const folder_id&
folder)
22497 std::stringstream sstr;
22498 sstr <<
"<m:CreateItem>";
22500 if (folder.
valid())
22502 sstr <<
"<m:SavedItemFolderId>" << folder.to_xml()
22503 <<
"</m:SavedItemFolderId>";
22506 sstr <<
"<m:Items>";
22507 sstr <<
"<t:" << the_item.item_tag_name() <<
">";
22508 sstr << the_item.xml().to_string();
22509 sstr <<
"</t:" << the_item.item_tag_name() <<
">";
22510 sstr <<
"</m:Items>" 22513 auto response = request(sstr.str());
22514 const auto response_message =
22515 internal::create_item_response_message::parse(std::move(response));
22516 if (!response_message.success())
22520 check(!response_message.items().empty(),
"Expected at least one item");
22521 return response_message.items().front();
22525 template <
typename ItemType>
22526 std::vector<item_id> create_item_impl(
const std::vector<ItemType>& items,
22527 const folder_id& folder)
22529 std::stringstream sstr;
22530 sstr <<
"<m:CreateItem>";
22532 if (folder.
valid())
22534 sstr <<
"<m:SavedItemFolderId>" << folder.to_xml()
22535 <<
"</m:SavedItemFolderId>";
22538 sstr <<
"<m:Items>";
22539 for (
const auto&
item : items)
22541 sstr <<
"<t:" <<
item.item_tag_name() <<
">";
22542 sstr <<
item.xml().to_string();
22543 sstr <<
"</t:" <<
item.item_tag_name() <<
">";
22545 sstr <<
"</m:Items>" 22548 auto response = request(sstr.str());
22549 const auto response_messages =
22550 internal::item_response_messages<ItemType>::parse(
22551 std::move(response));
22552 if (!response_messages.success())
22554 throw exchange_error(response_messages.first_error_or_warning());
22556 check(!response_messages.items().empty(),
"Expected at least one item");
22558 const std::vector<ItemType> res_items = response_messages.items();
22559 std::vector<item_id> res;
22560 res.reserve(res_items.size());
22561 std::transform(begin(res_items),
end(res_items),
22562 std::back_inserter(res),
22563 [](
const ItemType& elem) {
return elem.get_item_id(); });
22569 send_meeting_invitations send_invitations,
22570 const folder_id& folder)
22572 using internal::create_item_response_message;
22574 std::stringstream sstr;
22575 sstr <<
"<m:CreateItem SendMeetingInvitations=\"" 22576 << internal::enum_to_str(send_invitations) <<
"\">";
22578 if (folder.
valid())
22580 sstr <<
"<m:SavedItemFolderId>" << folder.to_xml()
22581 <<
"</m:SavedItemFolderId>";
22584 sstr <<
"<m:Items>" 22585 "<t:CalendarItem>";
22586 sstr << the_calendar_item.xml().to_string();
22587 sstr <<
"</t:CalendarItem>" 22591 auto response = request(sstr.str());
22593 const auto response_message =
22594 create_item_response_message::parse(std::move(response));
22595 if (!response_message.success())
22599 check(!response_message.items().empty(),
"Expected a message item");
22600 return response_message.items().front();
22603 std::vector<item_id>
22604 create_item_impl(
const std::vector<calendar_item>& items,
22605 send_meeting_invitations send_invitations,
22606 const folder_id& folder)
22608 std::stringstream sstr;
22609 sstr <<
"<m:CreateItem SendMeetingInvitations=\"" 22610 << internal::enum_to_str(send_invitations) <<
"\">";
22612 if (folder.
valid())
22614 sstr <<
"<m:SavedItemFolderId>" << folder.to_xml()
22615 <<
"</m:SavedItemFolderId>";
22618 sstr <<
"<m:Items>";
22619 for (
const auto&
item : items)
22621 sstr <<
"<t:CalendarItem>";
22622 sstr <<
item.xml().to_string();
22623 sstr <<
"</t:CalendarItem>";
22625 sstr <<
"</m:Items>" 22628 auto response = request(sstr.str());
22629 const auto response_messages =
22630 internal::item_response_messages<calendar_item>::parse(
22631 std::move(response));
22632 if (!response_messages.success())
22634 throw exchange_error(response_messages.first_error_or_warning());
22636 check(!response_messages.items().empty(),
"Expected at least one item");
22638 const std::vector<calendar_item> res_items = response_messages.items();
22639 std::vector<item_id> res;
22640 res.reserve(res_items.size());
22642 begin(res_items),
end(res_items), std::back_inserter(res),
22648 folder_id create_folder_impl(
const folder& new_folder,
22649 const folder_id& parent_folder)
22651 check(parent_folder.
valid(),
"Given parent_folder is not valid");
22653 std::stringstream sstr;
22654 sstr <<
"<m:CreateFolder >" 22655 "<m:ParentFolderId>" 22656 << parent_folder.to_xml()
22657 <<
"</m:ParentFolderId>" 22660 << new_folder.xml().to_string()
22663 "</m:CreateFolder>";
22665 auto response = request(sstr.str());
22666 const auto response_message =
22667 internal::create_folder_response_message::parse(
22668 std::move(response));
22669 if (!response_message.success())
22673 check(!response_message.items().empty(),
"Expected at least one item");
22674 return response_message.items().front();
22677 std::vector<folder_id>
22678 create_folder_impl(
const std::vector<folder>& new_folders,
22679 const folder_id& parent_folder)
22681 check(parent_folder.
valid(),
"Given parent_folder is not valid");
22683 std::stringstream sstr;
22684 sstr <<
"<m:CreateFolder >" 22685 "<m:ParentFolderId>" 22686 << parent_folder.to_xml()
22687 <<
"</m:ParentFolderId>" 22689 for (
const auto& folder : new_folders)
22691 sstr <<
"<t:Folder>" << folder.xml().to_string() <<
"</t:Folder>";
22693 sstr <<
"</m:Folders>" 22694 "</m:CreateFolder>";
22696 auto response = request(sstr.str());
22697 const auto response_messages =
22698 internal::folder_response_message::parse(std::move(response));
22699 if (!response_messages.success())
22701 throw exchange_error(response_messages.first_error_or_warning());
22703 check(!response_messages.items().empty(),
"Expected at least one item");
22705 const std::vector<folder> items = response_messages.items();
22706 std::vector<folder_id> res;
22707 res.reserve(items.size());
22708 std::transform(begin(items),
end(items), std::back_inserter(res),
22716 const folder_id& folder)
22718 std::stringstream sstr;
22719 sstr <<
"<m:CreateItem MessageDisposition=\"" 22720 << internal::enum_to_str(disposition) <<
"\">";
22722 if (folder.
valid())
22724 sstr <<
"<m:SavedItemFolderId>" << folder.to_xml()
22725 <<
"</m:SavedItemFolderId>";
22728 sstr <<
"<m:Items>" 22730 sstr << the_message.xml().to_string();
22731 sstr <<
"</t:Message>" 22735 auto response = request(sstr.str());
22737 const auto response_message =
22738 internal::create_item_response_message::parse(std::move(response));
22739 if (!response_message.success())
22746 check(!response_message.items().empty(),
"Expected a message item");
22747 return response_message.items().front();
22753 std::vector<item_id> create_item_impl(
const std::vector<message>& messages,
22755 const folder_id& folder)
22757 std::stringstream sstr;
22758 sstr <<
"<m:CreateItem MessageDisposition=\"" 22759 << internal::enum_to_str(disposition) <<
"\">";
22761 if (folder.
valid())
22763 sstr <<
"<m:SavedItemFolderId>" << folder.to_xml()
22764 <<
"</m:SavedItemFolderId>";
22767 sstr <<
"<m:Items>";
22768 for (
const auto&
item : messages)
22770 sstr <<
"<t:Message>";
22771 sstr <<
item.xml().to_string();
22772 sstr <<
"</t:Message>";
22774 sstr <<
"</m:Items>" 22777 auto response = request(sstr.str());
22778 const auto response_messages =
22779 internal::item_response_messages<message>::parse(
22780 std::move(response));
22781 if (!response_messages.success())
22783 throw exchange_error(response_messages.first_error_or_warning());
22787 check(!response_messages.items().empty(),
"Expected at least one item");
22790 const std::vector<message> items = response_messages.items();
22791 std::vector<item_id> res;
22792 res.reserve(items.size());
22793 std::transform(begin(items),
end(items), std::back_inserter(res),
22802 const folder_id& folder)
22804 std::stringstream sstr;
22805 sstr <<
"<m:UpdateItem " 22806 "MessageDisposition=\"SaveOnly\" " 22807 "ConflictResolution=\"" 22808 << internal::enum_to_str(resolution)
22809 <<
"\" SendMeetingInvitationsOrCancellations=\"" 22810 << internal::enum_to_str(invitations_or_cancellations) +
"\">";
22812 if (folder.
valid())
22814 sstr <<
"<m:SavedItemFolderId>" << folder.to_xml()
22815 <<
"</m:SavedItemFolderId>";
22818 sstr <<
"<m:ItemChanges>" 22820 <<
id.to_xml() <<
"<t:Updates>" << change.
to_item_xml()
22826 auto response = request(sstr.str());
22827 const auto response_message =
22828 internal::update_item_response_message::parse(std::move(response));
22829 if (!response_message.success())
22833 check(!response_message.items().empty(),
"Expected at least one item");
22834 return response_message.items().front();
22838 update_item_impl(
item_id id,
const std::vector<update>& changes,
22841 const folder_id& folder)
22843 std::stringstream sstr;
22844 sstr <<
"<m:UpdateItem " 22845 "MessageDisposition=\"SaveOnly\" " 22846 "ConflictResolution=\"" 22847 << internal::enum_to_str(resolution)
22848 <<
"\" SendMeetingInvitationsOrCancellations=\"" 22849 << internal::enum_to_str(cancellations) +
"\">";
22851 if (folder.
valid())
22853 sstr <<
"<m:SavedItemFolderId>" << folder.to_xml()
22854 <<
"</m:SavedItemFolderId>";
22857 sstr <<
"<m:ItemChanges>";
22858 sstr <<
"<t:ItemChange>" <<
id.to_xml() <<
"<t:Updates>";
22860 for (
const auto& change : changes)
22865 sstr <<
"</t:Updates>" 22870 auto response = request(sstr.str());
22871 const auto response_message =
22872 internal::update_item_response_message::parse(std::move(response));
22873 if (!response_message.success())
22877 check(!response_message.items().empty(),
"Expected at least one item");
22878 return response_message.items().front();
22881 folder_id update_folder_impl(folder_id
id,
update change)
22883 std::stringstream sstr;
22884 sstr <<
"<m:UpdateFolder>" 22885 "<m:FolderChanges>" 22889 "</t:FolderChange>" 22890 "</m:FolderChanges>" 22891 "</m:UpdateFolder>";
22893 auto response = request(sstr.str());
22894 const auto response_message =
22895 internal::update_folder_response_message::parse(
22896 std::move(response));
22897 if (!response_message.success())
22901 check(!response_message.items().empty(),
22902 "Expected at least one folder");
22903 return response_message.items().front();
22906 folder_id update_folder_impl(folder_id
id,
22907 const std::vector<update>& changes)
22909 std::stringstream sstr;
22910 sstr <<
"<m:UpdateFolder>" 22911 "<m:FolderChanges>" 22913 <<
id.to_xml() <<
"<t:Updates>";
22915 for (
const auto& change : changes)
22920 sstr <<
"</t:Updates>" 22921 "</t:FolderChange>" 22922 "</m:FolderChanges>" 22923 "</m:UpdateFolder>";
22925 auto response = request(sstr.str());
22926 const auto response_message =
22927 internal::update_folder_response_message::parse(
22928 std::move(response));
22929 if (!response_message.success())
22933 check(!response_message.items().empty(),
22934 "Expected at least one folder");
22935 return response_message.items().front();
22940 std::stringstream sstr;
22941 sstr <<
"<m:MoveItem>" 22944 <<
"</m:ToFolderId>" 22950 auto response = request(sstr.str());
22951 const auto response_messages =
22952 internal::move_item_response_message::parse(std::move(response));
22953 if (!response_messages.success())
22955 throw exchange_error(response_messages.first_error_or_warning());
22957 check(!response_messages.items().empty(),
"Expected at least one item");
22958 return response_messages.items().front();
22961 std::vector<item_id> move_item_impl(
const std::vector<item_id>& items,
22962 const folder_id& folder)
22964 std::stringstream sstr;
22965 sstr <<
"<m:MoveItem>" 22968 <<
"</m:ToFolderId>" 22971 for (
const auto& item : items)
22976 sstr <<
"</m:ItemIds>" 22979 auto response = request(sstr.str());
22980 const auto response_messages =
22981 internal::move_item_response_message::parse(std::move(response));
22982 if (!response_messages.success())
22984 throw exchange_error(response_messages.first_error_or_warning());
22986 check(!response_messages.items().empty(),
"Expected at least one item");
22988 return response_messages.items();
22991 folder_id move_folder_impl(folder_id folder,
const folder_id& target)
22993 std::stringstream sstr;
22994 sstr <<
"<m:MoveFolder>" 22997 <<
"</m:ToFolderId>" 23000 <<
"</m:FolderIds>" 23003 auto response = request(sstr.str());
23004 const auto response_messages =
23005 internal::move_folder_response_message::parse(std::move(response));
23006 if (!response_messages.success())
23008 throw exchange_error(response_messages.first_error_or_warning());
23010 check(!response_messages.items().empty(),
"Expected at least one item");
23011 return response_messages.items().front();
23014 std::vector<folder_id>
23015 move_folder_impl(
const std::vector<folder_id>& folders,
23016 const folder_id& target)
23018 std::stringstream sstr;
23019 sstr <<
"<m:MoveFolder>" 23022 <<
"</m:ToFolderId>" 23025 for (
const auto& folder : folders)
23027 sstr << folder.to_xml();
23030 sstr <<
"</m:FolderIds>" 23033 auto response = request(sstr.str());
23034 const auto response_messages =
23035 internal::move_folder_response_message::parse(std::move(response));
23036 if (!response_messages.success())
23038 throw exchange_error(response_messages.first_error_or_warning());
23040 check(!response_messages.items().empty(),
"Expected at least one item");
23042 return response_messages.items();
23046 resolve_names_impl(
const std::string& name,
23047 const std::vector<folder_id>& parent_folder_ids,
23050 auto version = get_request_server_version();
23051 std::stringstream sstr;
23052 sstr <<
"<m:ResolveNames " 23053 <<
"ReturnFullContactData=\"" 23056 <<
"SearchScope=\"" << internal::enum_to_str(scope) <<
"\" ";
23062 sstr <<
"ContactDataShape=\"IdOnly\"";
23065 if (parent_folder_ids.size() > 0)
23067 sstr <<
"<ParentFolderIds>";
23068 for (
const auto&
id : parent_folder_ids)
23070 sstr <<
id.to_xml();
23072 sstr <<
"</ParentFolderIds>";
23074 sstr <<
"<m:UnresolvedEntry>" << name <<
"</m:UnresolvedEntry>" 23075 <<
"</m:ResolveNames>";
23076 auto response = request(sstr.str());
23077 const auto response_message =
23078 internal::resolve_names_response_message::parse(
23079 std::move(response));
23080 if (response_message.result().code ==
23082 response_message.result().code ==
23091 return response_message.resolutions();
23094 #ifdef EWS_HAS_VARIANT 23095 subscription_information
23096 subscribe_impl(
const std::vector<distinguished_folder_id>& ids,
23097 const std::vector<event_type>& types,
int timeout)
23099 std::stringstream sstr;
23100 sstr <<
"<m:Subscribe>" 23101 <<
"<m:PullSubscriptionRequest>" 23102 <<
"<t:FolderIds>";
23103 for (
const auto&
id : ids)
23105 sstr <<
"<t:DistinguishedFolderId Id=\"" <<
id.id() <<
"\"/>";
23107 sstr <<
"</t:FolderIds>" 23108 <<
"<t:EventTypes>";
23109 for (
const auto& type : types)
23111 sstr <<
"<t:EventType>" << internal::enum_to_str(type)
23112 <<
"</t:EventType>";
23114 sstr <<
"</t:EventTypes>" 23115 <<
"<t:Timeout>" << timeout <<
"</t:Timeout>" 23116 <<
"</m:PullSubscriptionRequest>" 23117 <<
"</m:Subscribe>";
23118 auto response = request(sstr.str());
23119 const auto response_message =
23120 internal::subscribe_response_message::parse(std::move(response));
23125 return response_message.information();
23128 void unsubscribe_impl(
const std::string&
id)
23130 std::stringstream sstr;
23131 sstr <<
"<m:Unsubscribe>" 23132 <<
"<m:SubscriptionId>" <<
id <<
"</m:SubscriptionId>" 23133 <<
"</m:Unsubscribe>";
23134 auto response = request(sstr.str());
23135 const auto response_message =
23136 internal::unsubscribe_response_message::parse(std::move(response));
23143 notification get_events_impl(
const std::string&
id,
const std::string& mark)
23145 std::stringstream sstr;
23146 sstr <<
"<m:GetEvents>" 23147 <<
"<m:SubscriptionId>" <<
id <<
"</m:SubscriptionId>" 23148 <<
"<m:Watermark>" << mark <<
"</m:Watermark>" 23149 <<
"</m:GetEvents>";
23150 auto response = request(sstr.str());
23151 const auto response_message =
23152 internal::get_events_response_message::parse(std::move(response));
23157 return response_message.get_notification();
23163 #if defined(EWS_HAS_NON_BUGGY_TYPE_TRAITS) && \ 23164 defined(EWS_HAS_CXX17_STATIC_ASSERT) 23165 static_assert(!std::is_default_constructible<service>::value);
23166 static_assert(!std::is_copy_constructible<service>::value);
23167 static_assert(!std::is_copy_assignable<service>::value);
23168 static_assert(std::is_move_constructible<service>::value);
23169 static_assert(std::is_move_assignable<service>::value);
23174 inline void basic_credentials::certify(internal::http_request* request)
const 23176 check(request,
"Expected request, got nullptr");
23178 std::string login = username_ +
":" + password_;
23179 request->set_option(CURLOPT_USERPWD, login.c_str());
23180 request->set_option(CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
23183 inline void ntlm_credentials::certify(internal::http_request* request)
const 23185 check(request,
"Expected request, got nullptr");
23188 std::string login =
23189 (domain_.empty() ?
"" : domain_ +
"\\") + username_ +
":" + password_;
23190 request->set_option(CURLOPT_USERPWD, login.c_str());
23191 request->set_option(CURLOPT_HTTPAUTH, CURLAUTH_NTLM);
23195 internal::oauth2_basic::certify(internal::http_request* request)
const 23197 check(request,
"Expected request, got nullptr");
23201 if (access_token.empty() || expired())
23203 authenticate(request);
23206 request->set_authorization(
"Bearer " + access_token);
23210 internal::oauth2_basic::authenticate(internal::http_request* request)
const 23213 internal::http_request req(request->get_handle());
23216 CURL* c = req.get_handle().get();
23218 char* escaped_client_id =
23219 curl_easy_escape(c, client_id_.c_str(),
23220 internal::numeric_cast<
int>(client_id_.length()));
23223 "https://login.microsoftonline.com/" + tenant_ +
"/oauth2/v2.0/token";
23226 data.append(
"client_id=");
23227 data.append(escaped_client_id);
23229 curl_free(escaped_client_id);
23231 if (!scope_.empty())
23233 char* escaped_scope = curl_easy_escape(
23234 c, scope_.c_str(), internal::numeric_cast<
int>(scope_.length()));
23235 data.append(
"&scope=");
23236 data.append(escaped_scope);
23237 curl_free(escaped_scope);
23240 append_url(c, data);
23243 req.set_option(CURLOPT_URL, url.c_str());
23244 req.set_option(CURLOPT_HTTPGET, 1L);
23245 internal::http_response res = req.send(data);
23247 std::vector<char> content_vector = res.content();
23248 std::string content(content_vector.begin(), content_vector.end());
23250 rapidjson::Document document;
23251 document.Parse(content.c_str());
23254 if (document.HasParseError())
23256 throw exception(
"OAuth2 Error: JSON Parse Error");
23259 if (!document.IsObject())
23261 throw exception(
"OAuth2 Error: Response is not a JSON Object");
23264 if (!document.HasMember(
"access_token") ||
23265 !document[
"access_token"].IsString())
23267 throw exception(
"OAuth2 Error: no access_token in response\n" 23272 if (!document.HasMember(
"expires_in") || !document[
"expires_in"].IsNumber())
23274 throw exception(
"OAuth2 Error: no expiration time in response\n" 23279 access_token = document[
"access_token"].GetString();
23280 expiration = std::chrono::steady_clock::time_point(
23281 std::chrono::seconds(document[
"expires_in"].GetUint64()));
23285 oauth2_resource_owner_password_credentials::append_url(CURL* c,
23286 std::string& data)
const 23288 char* escaped_client_secret =
23289 curl_easy_escape(c, client_secret_.c_str(),
23290 internal::numeric_cast<
int>(client_secret_.length()));
23291 char* escaped_username = curl_easy_escape(
23292 c, username_.c_str(), internal::numeric_cast<
int>(username_.length()));
23293 char* escaped_password = curl_easy_escape(
23294 c, password_.c_str(), internal::numeric_cast<
int>(password_.length()));
23296 data.append(
"&client_secret=");
23297 data.append(escaped_client_secret);
23298 data.append(
"&username=");
23299 data.append(escaped_username);
23300 data.append(
"&password=");
23301 data.append(escaped_password);
23302 data.append(
"&grant_type=password");
23304 curl_free(escaped_client_secret);
23305 curl_free(escaped_username);
23306 curl_free(escaped_password);
23309 inline void oauth2_client_credentials::append_url(CURL* c,
23310 std::string& data)
const 23312 char* escaped_client_secret =
23313 curl_easy_escape(c, client_secret_.c_str(),
23314 internal::numeric_cast<
int>(client_secret_.length()));
23315 char* escaped_resource = curl_easy_escape(
23316 c, resource_.c_str(), internal::numeric_cast<
int>(resource_.length()));
23318 data.append(
"&client_secret=");
23319 data.append(escaped_client_secret);
23320 data.append(
"&ressource=");
23321 data.append(escaped_resource);
23322 data.append(
"&grant_type=client_credentials");
23324 curl_free(escaped_resource);
23325 curl_free(escaped_client_secret);
23328 #ifndef EWS_DOXYGEN_SHOULD_SKIP_THIS 23330 sync_folder_hierarchy_result::parse(internal::http_response&& response)
23332 using rapidxml::internal::compare;
23334 const auto doc = parse_response(std::move(response));
23335 auto elem = internal::get_element_by_qname(
23336 *doc,
"SyncFolderHierarchyResponseMessage",
23337 internal::uri<>::microsoft::messages());
23339 check(elem,
"Expected <SyncFolderHierarchyResponseMessage>");
23340 auto result = internal::parse_response_class_and_code(*elem);
23346 auto sync_state_elem = elem->first_node_ns(
23347 internal::uri<>::microsoft::messages(),
"SyncState");
23348 check(sync_state_elem,
"Expected <SyncState> element");
23350 std::string(sync_state_elem->value(), sync_state_elem->value_size());
23352 auto includes_last_folder_in_range_elem = elem->first_node_ns(
23353 internal::uri<>::microsoft::messages(),
"IncludesLastFolderInRange");
23354 check(includes_last_folder_in_range_elem,
23355 "Expected <IncludesLastFolderInRange> element");
23356 auto includes_last_folder_in_range = rapidxml::internal::compare(
23357 includes_last_folder_in_range_elem->value(),
23358 includes_last_folder_in_range_elem->value_size(),
"true",
23361 auto changes_elem =
23362 elem->first_node_ns(internal::uri<>::microsoft::messages(),
"Changes");
23363 check(changes_elem,
"Expected <Changes> element");
23364 std::vector<folder> created_folders;
23365 std::vector<folder> updated_folders;
23366 std::vector<folder_id> deleted_folder_ids;
23367 internal::for_each_child_node(
23369 [&created_folders, &updated_folders,
23370 &deleted_folder_ids](
const rapidxml::xml_node<>& item_elem) {
23371 if (compare(item_elem.local_name(), item_elem.local_name_size(),
23372 "Create", strlen(
"Create")))
23374 const auto folder_elem = item_elem.first_node();
23376 created_folders.emplace_back(
folder);
23379 if (compare(item_elem.local_name(), item_elem.local_name_size(),
23380 "Update", strlen(
"Update")))
23382 const auto folder_elem = item_elem.first_node();
23384 updated_folders.emplace_back(
folder);
23387 if (compare(item_elem.local_name(), item_elem.local_name_size(),
23388 "Delete", strlen(
"Delete")))
23390 const auto folder_id_elem = item_elem.first_node_ns(
23391 internal::uri<>::microsoft::types(),
"FolderId");
23392 check(folder_id_elem,
"Expected <Folder> element");
23395 deleted_folder_ids.emplace_back(
folder);
23400 response_message.sync_state_ = std::move(sync_state);
23401 response_message.created_folders_ = std::move(created_folders);
23402 response_message.updated_folders_ = std::move(updated_folders);
23403 response_message.deleted_folder_ids_ = std::move(deleted_folder_ids);
23404 response_message.includes_last_folder_in_range_ =
23405 includes_last_folder_in_range;
23407 return response_message;
23411 #ifndef EWS_DOXYGEN_SHOULD_SKIP_THIS 23413 sync_folder_items_result::parse(internal::http_response&& response)
23415 using rapidxml::internal::compare;
23417 const auto doc = parse_response(std::move(response));
23419 internal::get_element_by_qname(*doc,
"SyncFolderItemsResponseMessage",
23420 internal::uri<>::microsoft::messages());
23422 check(elem,
"Expected <SyncFolderItemsResponseMessage>");
23423 auto result = internal::parse_response_class_and_code(*elem);
23429 auto sync_state_elem = elem->first_node_ns(
23430 internal::uri<>::microsoft::messages(),
"SyncState");
23431 check(sync_state_elem,
"Expected <SyncState> element");
23433 std::string(sync_state_elem->value(), sync_state_elem->value_size());
23435 auto includes_last_item_in_range_elem = elem->first_node_ns(
23436 internal::uri<>::microsoft::messages(),
"IncludesLastItemInRange");
23437 check(includes_last_item_in_range_elem,
23438 "Expected <IncludesLastItemInRange> element");
23439 auto includes_last_item_in_range = rapidxml::internal::compare(
23440 includes_last_item_in_range_elem->value(),
23441 includes_last_item_in_range_elem->value_size(),
"true", strlen(
"true"));
23443 auto changes_elem =
23444 elem->first_node_ns(internal::uri<>::microsoft::messages(),
"Changes");
23445 check(changes_elem,
"Expected <Changes> element");
23446 std::vector<item_id> created_items;
23447 std::vector<item_id> updated_items;
23449 std::vector<std::pair<item_id, bool>> read_flag_changed;
23450 internal::for_each_child_node(
23452 [&created_items, &updated_items, &deleted_items,
23453 &read_flag_changed](
const rapidxml::xml_node<>& item_elem) {
23454 if (compare(item_elem.local_name(), item_elem.local_name_size(),
23455 "Create", strlen(
"Create")))
23457 const auto item_id_elem = item_elem.first_node()->first_node_ns(
23458 internal::uri<>::microsoft::types(),
"ItemId");
23459 check(item_id_elem,
"Expected <ItemId> element");
23461 created_items.emplace_back(
item_id);
23464 if (compare(item_elem.local_name(), item_elem.local_name_size(),
23465 "Update", strlen(
"Update")))
23467 const auto item_id_elem = item_elem.first_node()->first_node_ns(
23468 internal::uri<>::microsoft::types(),
"ItemId");
23469 check(item_id_elem,
"Expected <ItemId> element");
23471 updated_items.emplace_back(
item_id);
23474 if (compare(item_elem.local_name(), item_elem.local_name_size(),
23475 "Delete", strlen(
"Delete")))
23477 const auto item_id_elem = item_elem.first_node_ns(
23478 internal::uri<>::microsoft::types(),
"ItemId");
23479 check(item_id_elem,
"Expected <ItemId> element");
23481 deleted_items.emplace_back(
item_id);
23484 if (compare(item_elem.local_name(), item_elem.local_name_size(),
23485 "ReadFlagChange", strlen(
"ReadFlagChange")))
23487 const auto item_id_elem = item_elem.first_node_ns(
23488 internal::uri<>::microsoft::types(),
"ItemId");
23489 check(item_id_elem,
"Expected <ItemId> element");
23491 const auto read_elem = item_elem.first_node_ns(
23492 internal::uri<>::microsoft::types(),
"IsRead");
23493 check(read_elem,
"Expected <IsRead> element");
23498 compare(read_elem->value(), read_elem->value_size(),
"true",
23501 read_flag_changed.emplace_back(std::make_pair(
item_id, read));
23506 response_message.sync_state_ = std::move(sync_state);
23507 response_message.created_items_ = std::move(created_items);
23508 response_message.updated_items_ = std::move(updated_items);
23509 response_message.deleted_items_ = std::move(deleted_items);
23510 response_message.read_flag_changed_ = std::move(read_flag_changed);
23511 response_message.includes_last_item_in_range_ = includes_last_item_in_range;
23513 return response_message;
23519 inline create_folder_response_message
23520 create_folder_response_message::parse(http_response&& response)
23522 const auto doc = parse_response(std::move(response));
23523 auto elem = get_element_by_qname(*doc,
"CreateFolderResponseMessage",
23524 uri<>::microsoft::messages());
23526 check(elem,
"Expected <CreateFolderResponseMessage>");
23527 auto result = parse_response_class_and_code(*elem);
23528 auto item_ids = std::vector<folder_id>();
23530 elem->first_node_ns(uri<>::microsoft::messages(),
"Folders");
23531 check(items_elem,
"Expected <Folders> element");
23533 for_each_child_node(
23534 *items_elem, [&item_ids](
const rapidxml::xml_node<>& item_elem) {
23535 auto item_id_elem = item_elem.first_node();
23536 check(item_id_elem,
"Expected <FolderId> element");
23537 item_ids.emplace_back(
23540 return create_folder_response_message(std::move(result),
23541 std::move(item_ids));
23544 inline create_item_response_message
23545 create_item_response_message::parse(http_response&& response)
23547 const auto doc = parse_response(std::move(response));
23548 auto elem = get_element_by_qname(*doc,
"CreateItemResponseMessage",
23549 uri<>::microsoft::messages());
23551 check(elem,
"Expected <CreateItemResponseMessage>");
23552 auto result = parse_response_class_and_code(*elem);
23553 auto item_ids = std::vector<item_id>();
23555 elem->first_node_ns(uri<>::microsoft::messages(),
"Items");
23556 check(items_elem,
"Expected <Items> element");
23558 for_each_child_node(
23559 *items_elem, [&item_ids](
const rapidxml::xml_node<>& item_elem) {
23560 auto item_id_elem = item_elem.first_node();
23561 check(item_id_elem,
"Expected <ItemId> element");
23564 return create_item_response_message(std::move(result),
23565 std::move(item_ids));
23568 inline find_folder_response_message
23569 find_folder_response_message::parse(http_response&& response)
23571 const auto doc = parse_response(std::move(response));
23572 auto elem = get_element_by_qname(*doc,
"FindFolderResponseMessage",
23573 uri<>::microsoft::messages());
23575 check(elem,
"Expected <FindFolderResponseMessage>");
23576 auto result = parse_response_class_and_code(*elem);
23579 elem->first_node_ns(uri<>::microsoft::messages(),
"RootFolder");
23582 root_folder->first_node_ns(uri<>::microsoft::types(),
"Folders");
23583 check(items_elem,
"Expected <Folders> element");
23585 auto items = std::vector<folder_id>();
23586 for (
auto item_elem = items_elem->first_node(); item_elem;
23587 item_elem = item_elem->next_sibling())
23590 check(item_elem,
"Expected an element");
23591 auto item_id_elem = item_elem->first_node();
23592 check(item_id_elem,
"Expected <FolderId> element");
23595 return find_folder_response_message(std::move(result),
23599 inline find_item_response_message
23600 find_item_response_message::parse(http_response&& response)
23602 const auto doc = parse_response(std::move(response));
23603 auto elem = get_element_by_qname(*doc,
"FindItemResponseMessage",
23604 uri<>::microsoft::messages());
23606 check(elem,
"Expected <FindItemResponseMessage>");
23607 auto result = parse_response_class_and_code(*elem);
23610 elem->first_node_ns(uri<>::microsoft::messages(),
"RootFolder");
23613 root_folder->first_node_ns(uri<>::microsoft::types(),
"Items");
23614 check(items_elem,
"Expected <Items> element");
23616 auto items = std::vector<item_id>();
23617 for (
auto item_elem = items_elem->first_node(); item_elem;
23618 item_elem = item_elem->next_sibling())
23620 check(item_elem,
"Expected an element");
23621 auto item_id_elem = item_elem->first_node();
23622 check(item_id_elem,
"Expected <ItemId> element");
23625 return find_item_response_message(std::move(result), std::move(items));
23628 inline find_calendar_item_response_message
23629 find_calendar_item_response_message::parse(http_response&& response)
23631 const auto doc = parse_response(std::move(response));
23632 auto elem = get_element_by_qname(*doc,
"FindItemResponseMessage",
23633 uri<>::microsoft::messages());
23635 check(elem,
"Expected <FindItemResponseMessage>");
23636 auto result = parse_response_class_and_code(*elem);
23638 check_response_message_for_error(*elem);
23641 elem->first_node_ns(uri<>::microsoft::messages(),
"RootFolder");
23642 check(root_folder,
"Expected <RootFolder> element");
23645 root_folder->first_node_ns(uri<>::microsoft::types(),
"Items");
23646 check(items_elem,
"Expected <Items> element");
23648 auto items = std::vector<calendar_item>();
23649 for_each_child_node(
23650 *items_elem, [&items](
const rapidxml::xml_node<>& item_elem) {
23653 return find_calendar_item_response_message(std::move(result),
23657 inline update_item_response_message
23658 update_item_response_message::parse(http_response&& response)
23660 const auto doc = parse_response(std::move(response));
23661 auto elem = get_element_by_qname(*doc,
"UpdateItemResponseMessage",
23662 uri<>::microsoft::messages());
23664 check(elem,
"Expected <UpdateItemResponseMessage>");
23665 auto result = parse_response_class_and_code(*elem);
23668 elem->first_node_ns(uri<>::microsoft::messages(),
"Items");
23669 check(items_elem,
"Expected <Items> element");
23671 auto items = std::vector<item_id>();
23672 for (
auto item_elem = items_elem->first_node(); item_elem;
23673 item_elem = item_elem->next_sibling())
23675 check(item_elem,
"Expected an element");
23676 auto item_id_elem = item_elem->first_node();
23677 check(item_id_elem,
"Expected <ItemId> element");
23680 return update_item_response_message(std::move(result),
23684 inline update_folder_response_message
23685 update_folder_response_message::parse(http_response&& response)
23687 const auto doc = parse_response(std::move(response));
23688 auto elem = get_element_by_qname(*doc,
"UpdateFolderResponseMessage",
23689 uri<>::microsoft::messages());
23691 check(elem,
"Expected <UpdateFolderResponseMessage>");
23692 auto result = parse_response_class_and_code(*elem);
23694 auto folders_elem =
23695 elem->first_node_ns(uri<>::microsoft::messages(),
"Folders");
23696 check(folders_elem,
"Expected <Folders> element");
23698 auto folders = std::vector<folder_id>();
23699 for (
auto folder_elem = folders_elem->first_node(); folder_elem;
23700 folder_elem = folder_elem->next_sibling())
23702 check(folder_elem,
"Expected an element");
23703 auto folder_id_elem = folder_elem->first_node();
23704 check(folder_id_elem,
"Expected <FolderId> element");
23707 return update_folder_response_message(std::move(result),
23708 std::move(folders));
23711 inline get_folder_response_message
23712 get_folder_response_message::parse(http_response&& response)
23714 const auto doc = parse_response(std::move(response));
23715 auto elem = get_element_by_qname(*doc,
"GetFolderResponseMessage",
23716 uri<>::microsoft::messages());
23717 check(elem,
"Expected <GetFolderResponseMessage>");
23718 auto result = parse_response_class_and_code(*elem);
23720 elem->first_node_ns(uri<>::microsoft::messages(),
"Folders");
23721 check(items_elem,
"Expected <Folders> element");
23722 auto items = std::vector<folder>();
23723 for_each_child_node(
23724 *items_elem, [&items](
const rapidxml::xml_node<>& item_elem) {
23727 return get_folder_response_message(std::move(result), std::move(items));
23730 inline get_room_lists_response_message
23731 get_room_lists_response_message::parse(http_response&& response)
23733 const auto doc = parse_response(std::move(response));
23734 auto elem = get_element_by_qname(*doc,
"GetRoomListsResponse",
23735 uri<>::microsoft::messages());
23736 check(elem,
"Expected <GetRoomListsResponse>");
23738 auto result = parse_response_class_and_code(*elem);
23744 auto room_lists = std::vector<mailbox>();
23746 elem->first_node_ns(uri<>::microsoft::messages(),
"RoomLists");
23747 check(items_elem,
"Expected <RoomLists> element");
23749 for_each_child_node(
23750 *items_elem, [&room_lists](
const rapidxml::xml_node<>& item_elem) {
23753 return get_room_lists_response_message(std::move(result),
23754 std::move(room_lists));
23757 inline get_rooms_response_message
23758 get_rooms_response_message::parse(http_response&& response)
23760 const auto doc = parse_response(std::move(response));
23761 auto elem = get_element_by_qname(*doc,
"GetRoomsResponse",
23762 uri<>::microsoft::messages());
23764 check(elem,
"Expected <GetRoomsResponse>");
23765 auto result = parse_response_class_and_code(*elem);
23766 auto rooms = std::vector<mailbox>();
23768 elem->first_node_ns(uri<>::microsoft::messages(),
"Rooms");
23771 return get_rooms_response_message(std::move(result),
23775 for_each_child_node(
23776 *items_elem, [&rooms](
const rapidxml::xml_node<>& item_elem) {
23778 item_elem.first_node_ns(uri<>::microsoft::types(),
"Id");
23779 check(room_elem,
"Expected <Id> element");
23782 return get_rooms_response_message(std::move(result), std::move(rooms));
23785 inline folder_response_message
23786 folder_response_message::parse(http_response&& response)
23788 const auto doc = parse_response(std::move(response));
23790 auto response_messages = get_element_by_qname(
23791 *doc,
"ResponseMessages", uri<>::microsoft::messages());
23792 check(response_messages,
"Expected <ResponseMessages> node");
23794 std::vector<folder_response_message::response_message> messages;
23795 for_each_child_node(
23796 *response_messages, [&](
const rapidxml::xml_node<>& node) {
23797 auto result = parse_response_class_and_code(node);
23800 node.first_node_ns(uri<>::microsoft::messages(),
"Folders");
23801 check(items_elem,
"Expected <Folders> element");
23803 auto items = std::vector<folder>();
23804 for_each_child_node(
23806 [&items](
const rapidxml::xml_node<>& item_elem) {
23810 messages.emplace_back(
23811 std::make_tuple(result.cls, result.code, std::move(items)));
23814 return folder_response_message(std::move(messages));
23817 template <
typename ItemType>
23818 inline get_item_response_message<ItemType>
23819 get_item_response_message<ItemType>::parse(http_response&& response)
23821 const auto doc = parse_response(std::move(response));
23822 auto elem = get_element_by_qname(*doc,
"GetItemResponseMessage",
23823 uri<>::microsoft::messages());
23824 check(elem,
"Expected <GetItemResponseMessage>");
23825 auto result = parse_response_class_and_code(*elem);
23827 elem->first_node_ns(uri<>::microsoft::messages(),
"Items");
23828 check(items_elem,
"Expected <Items> element");
23829 auto items = std::vector<ItemType>();
23830 for_each_child_node(
23831 *items_elem, [&items](
const rapidxml::xml_node<>& item_elem) {
23832 items.emplace_back(ItemType::from_xml_element(item_elem));
23834 return get_item_response_message(std::move(result), std::move(items));
23837 inline move_item_response_message
23838 move_item_response_message::parse(http_response&& response)
23840 const auto doc = parse_response(std::move(response));
23842 auto response_messages = get_element_by_qname(
23843 *doc,
"ResponseMessages", uri<>::microsoft::messages());
23844 check(response_messages,
"Expected <ResponseMessages> node");
23846 using rapidxml::internal::compare;
23848 std::vector<response_message_with_ids::response_message> messages;
23849 for_each_child_node(
23850 *response_messages, [&](
const rapidxml::xml_node<>& node) {
23851 check(compare(node.local_name(), node.local_name_size(),
23852 "MoveItemResponseMessage",
23853 strlen(
"MoveItemResponseMessage")),
23854 "Expected <MoveItemResponseMessage> element");
23856 auto result = parse_response_class_and_code(node);
23859 node.first_node_ns(uri<>::microsoft::messages(),
"Items");
23860 check(items_elem,
"Expected <Items> element");
23862 auto items = std::vector<item_id>();
23863 for_each_child_node(
23865 [&items](
const rapidxml::xml_node<>& item_elem) {
23866 auto item_id = item_elem.first_node_ns(
23867 uri<>::microsoft::types(),
"ItemId");
23868 check(
item_id,
"Expected <ItemId> element");
23872 messages.emplace_back(
23873 std::make_tuple(result.cls, result.code, std::move(items)));
23876 return move_item_response_message(std::move(messages));
23879 inline move_folder_response_message
23880 move_folder_response_message::parse(http_response&& response)
23882 const auto doc = parse_response(std::move(response));
23884 auto response_messages = get_element_by_qname(
23885 *doc,
"ResponseMessages", uri<>::microsoft::messages());
23886 check(response_messages,
"Expected <ResponseMessages> node");
23888 using rapidxml::internal::compare;
23890 std::vector<response_message_with_ids::response_message> messages;
23891 for_each_child_node(
23892 *response_messages, [&](
const rapidxml::xml_node<>& node) {
23893 check(compare(node.local_name(), node.local_name_size(),
23894 "MoveFolderResponseMessage",
23895 strlen(
"MoveFolderResponseMessage")),
23896 "Expected <MoveFolderResponseMessage> element");
23898 auto result = parse_response_class_and_code(node);
23900 auto folders_elem =
23901 node.first_node_ns(uri<>::microsoft::messages(),
"Folders");
23902 check(folders_elem,
"Expected <Folders> element");
23904 auto folders = std::vector<folder_id>();
23905 for_each_child_node(
23907 [&folders](
const rapidxml::xml_node<>& folder_elem) {
23908 auto folder_id = folder_elem.first_node_ns(
23909 uri<>::microsoft::types(),
"FolderId");
23910 check(folder_id,
"Expected <FolderId> element");
23911 folders.emplace_back(
23915 messages.emplace_back(std::make_tuple(result.cls, result.code,
23916 std::move(folders)));
23919 return move_folder_response_message(std::move(messages));
23922 template <
typename ItemType>
23923 inline item_response_messages<ItemType>
23924 item_response_messages<ItemType>::parse(http_response&& response)
23926 const auto doc = parse_response(std::move(response));
23928 auto response_messages = get_element_by_qname(
23929 *doc,
"ResponseMessages", uri<>::microsoft::messages());
23930 check(response_messages,
"Expected <ResponseMessages> node");
23932 std::vector<item_response_messages::response_message> messages;
23933 for_each_child_node(
23934 *response_messages, [&](
const rapidxml::xml_node<>& node) {
23935 auto result = parse_response_class_and_code(node);
23938 node.first_node_ns(uri<>::microsoft::messages(),
"Items");
23939 check(items_elem,
"Expected <Items> element");
23941 auto items = std::vector<ItemType>();
23942 for_each_child_node(
23944 [&items](
const rapidxml::xml_node<>& item_elem) {
23945 items.emplace_back(
23946 ItemType::from_xml_element(item_elem));
23949 messages.emplace_back(
23950 std::make_tuple(result.cls, result.code, std::move(items)));
23953 return item_response_messages(std::move(messages));
23956 inline std::vector<delegate_user> delegate_response_message::parse_users(
23957 const rapidxml::xml_node<>& response_element)
23959 using rapidxml::internal::compare;
23961 std::vector<delegate_user> delegate_users;
23962 for_each_child_node(
23963 response_element, [&](
const rapidxml::xml_node<>& node) {
23964 if (compare(node.local_name(), node.local_name_size(),
23965 "ResponseMessages", strlen(
"ResponseMessages")))
23967 for_each_child_node(
23968 node, [&](
const rapidxml::xml_node<>& msg) {
23969 for_each_child_node(
23971 [&](
const rapidxml::xml_node<>& msg_content) {
23972 if (compare(msg_content.local_name(),
23973 msg_content.local_name_size(),
23975 strlen(
"DelegateUser")))
23977 delegate_users.emplace_back(
23978 delegate_user::from_xml_element(
23985 return delegate_users;
23988 inline add_delegate_response_message
23989 add_delegate_response_message::parse(http_response&& response)
23991 const auto doc = parse_response(std::move(response));
23992 auto response_elem = get_element_by_qname(*doc,
"AddDelegateResponse",
23993 uri<>::microsoft::messages());
23994 check(response_elem,
"Expected <AddDelegateResponse>");
23995 auto result = parse_response_class_and_code(*response_elem);
23997 std::vector<delegate_user> delegates;
24000 delegates = delegate_response_message::parse_users(*response_elem);
24002 return add_delegate_response_message(std::move(result),
24003 std::move(delegates));
24006 inline get_delegate_response_message
24007 get_delegate_response_message::parse(http_response&& response)
24009 const auto doc = parse_response(std::move(response));
24010 auto response_elem = get_element_by_qname(*doc,
"GetDelegateResponse",
24011 uri<>::microsoft::messages());
24012 check(response_elem,
"Expected <GetDelegateResponse>");
24013 auto result = parse_response_class_and_code(*response_elem);
24015 std::vector<delegate_user> delegates;
24018 delegates = delegate_response_message::parse_users(*response_elem);
24020 return get_delegate_response_message(std::move(result),
24021 std::move(delegates));
24024 inline remove_delegate_response_message
24025 remove_delegate_response_message::parse(http_response&& response)
24027 const auto doc = parse_response(std::move(response));
24028 auto resp = get_element_by_qname(*doc,
"RemoveDelegateResponse",
24029 uri<>::microsoft::messages());
24030 check(resp,
"Expected <RemoveDelegateResponse>");
24032 auto result = parse_response_class_and_code(*resp);
24038 using rapidxml::internal::compare;
24040 for_each_child_node(*resp, [](
const rapidxml::xml_node<>& elem) {
24041 if (compare(elem.local_name(), elem.local_name_size(),
24042 "ResponseMessages", strlen(
"ResponseMessages")))
24044 for_each_child_node(
24045 elem, [](
const rapidxml::xml_node<>& msg) {
24046 auto response_class_attr =
24047 msg.first_attribute(
"ResponseClass");
24048 if (compare(response_class_attr->value(),
24049 response_class_attr->value_size(),
24059 auto rcode_elem = msg.first_node_ns(
24060 uri<>::microsoft::messages(),
24063 "Expected <ResponseCode> element");
24065 str_to_response_code(rcode_elem->value());
24067 auto message_text = msg.first_node_ns(
24068 uri<>::microsoft::messages(),
24075 message_text->value(),
24076 message_text->value_size()));
24086 return remove_delegate_response_message(std::move(result));
24089 inline resolve_names_response_message
24090 resolve_names_response_message::parse(http_response&& response)
24092 using rapidxml::internal::compare;
24093 const auto doc = parse_response(std::move(response));
24094 auto response_elem = get_element_by_qname(
24095 *doc,
"ResolveNamesResponseMessage", uri<>::microsoft::messages());
24096 check(response_elem,
"Expected <ResolveNamesResponseMessage>");
24097 auto result = parse_response_class_and_code(*response_elem);
24104 auto resolution_set_element = response_elem->first_node_ns(
24105 uri<>::microsoft::messages(),
"ResolutionSet");
24106 check(resolution_set_element,
"Expected <ResolutionSet> element");
24108 for (
auto attr = resolution_set_element->first_attribute();
24109 attr !=
nullptr; attr = attr->next_attribute())
24111 if (compare(
"IndexedPagingOffset",
24112 strlen(
"IndexedPagingOffset"), attr->local_name(),
24113 attr->local_name_size()))
24115 resolutions.indexed_paging_offset =
24116 std::stoi(resolution_set_element
24117 ->first_attribute(
"IndexedPagingOffset")
24120 if (compare(
"NumeratorOffset", strlen(
"NumeratorOffset"),
24121 attr->local_name(), attr->local_name_size()))
24123 resolutions.numerator_offset =
24124 std::stoi(resolution_set_element
24125 ->first_attribute(
"NumeratorOffset")
24128 if (compare(
"AbsoluteDenominator",
24129 strlen(
"AbsoluteDenominator"), attr->local_name(),
24130 attr->local_name_size()))
24132 resolutions.absolute_denominator =
24133 std::stoi(resolution_set_element
24134 ->first_attribute(
"AbsoluteDenominator")
24137 if (compare(
"IncludesLastItemInRange",
24138 strlen(
"IncludesLastItemInRange"),
24139 attr->local_name(), attr->local_name_size()))
24142 resolution_set_element
24143 ->first_attribute(
"IncludesLastItemInRange")
24147 resolutions.includes_last_item_in_range =
true;
24151 resolutions.includes_last_item_in_range =
false;
24154 if (compare(
"TotalItemsInView", strlen(
"TotalItemsInView"),
24155 attr->local_name(), attr->local_name_size()))
24157 resolutions.total_items_in_view =
24158 std::stoi(resolution_set_element
24159 ->first_attribute(
"TotalItemsInView")
24164 for (
auto res = resolution_set_element->first_node_ns(
24165 uri<>::microsoft::types(),
"Resolution");
24166 res; res = res->next_sibling())
24168 check(res,
"Expected <Resolution> element");
24171 if (compare(
"Mailbox", strlen(
"Mailbox"),
24172 res->first_node()->local_name(),
24173 res->first_node()->local_name_size()))
24175 auto mailbox_elem = res->first_node(
"t:Mailbox");
24178 if (compare(
"Contact", strlen(
"Contact"),
24179 res->last_node()->local_name(),
24180 res->last_node()->local_name_size()))
24182 auto contact_elem = res->last_node(
"t:Contact");
24183 auto directory_id_elem = contact_elem->first_node_ns(
24184 internal::uri<>::microsoft::types(),
"DirectoryId");
24186 if (directory_id_elem)
24189 r.directory_id = id;
24192 r.contact = std::make_shared<ews::contact>(
24197 resolutions.resolutions.emplace_back(r);
24200 return resolve_names_response_message(std::move(result),
24201 std::move(resolutions));
24204 #ifdef EWS_HAS_VARIANT 24205 inline subscribe_response_message
24206 subscribe_response_message::parse(http_response&& response)
24208 using rapidxml::internal::compare;
24209 const auto doc = parse_response(std::move(response));
24210 auto response_elem = get_element_by_qname(
24211 *doc,
"SubscribeResponseMessage", uri<>::microsoft::messages());
24212 check(response_elem,
"Expected <SubscribeResponseMessage>");
24213 auto result = parse_response_class_and_code(*response_elem);
24221 ->first_node_ns(uri<>::microsoft::messages(),
24227 ->first_node_ns(uri<>::microsoft::messages(),
"Watermark")
24230 return subscribe_response_message(std::move(result),
24231 subscription_information(
id, mark));
24234 inline unsubscribe_response_message
24235 unsubscribe_response_message::parse(http_response&& response)
24237 using rapidxml::internal::compare;
24238 const auto doc = parse_response(std::move(response));
24239 auto response_elem = get_element_by_qname(
24240 *doc,
"UnsubscribeResponseMessage", uri<>::microsoft::messages());
24241 check(response_elem,
"Expected <UnsubscribeResponseMessage>");
24242 auto result = parse_response_class_and_code(*response_elem);
24244 return unsubscribe_response_message(std::move(result));
24247 inline get_events_response_message
24248 get_events_response_message::parse(http_response&& response)
24250 using rapidxml::internal::compare;
24251 const auto doc = parse_response(std::move(response));
24252 auto response_elem = get_element_by_qname(
24253 *doc,
"GetEventsResponseMessage", uri<>::microsoft::messages());
24254 check(response_elem,
"Expected <GetEventsResponseMessage>");
24255 auto result = parse_response_class_and_code(*response_elem);
24260 auto notification_element = response_elem->first_node_ns(
24261 uri<>::microsoft::messages(),
"Notification");
24262 check(notification_element,
"Expected <Notification> element");
24264 n.subscription_id =
24265 notification_element
24266 ->first_node_ns(uri<>::microsoft::types(),
"SubscriptionId")
24269 n.previous_watermark =
24270 notification_element
24271 ->first_node_ns(uri<>::microsoft::types(),
24272 "PreviousWatermark")
24276 notification_element
24277 ->first_node_ns(uri<>::microsoft::types(),
"MoreEvents")
24280 if (notification_element->first_node_ns(uri<>::microsoft::types(),
24281 "StatusEvent") !=
nullptr)
24283 auto e = notification_element->first_node_ns(
24284 uri<>::microsoft::types(),
"StatusEvent");
24285 status_event s = status_event::from_xml_element(*e);
24286 n.events.emplace_back(s);
24290 for (
auto res = notification_element->first_node_ns(
24291 uri<>::microsoft::types(),
"CopiedEvent");
24292 res; res = res->next_sibling())
24294 copied_event c = copied_event::from_xml_element(*res);
24295 n.events.emplace_back(c);
24297 for (
auto res = notification_element->first_node_ns(
24298 uri<>::microsoft::types(),
"CreatedEvent");
24299 res; res = res->next_sibling())
24301 created_event c = created_event::from_xml_element(*res);
24302 n.events.emplace_back(c);
24304 for (
auto res = notification_element->first_node_ns(
24305 uri<>::microsoft::types(),
"DeletedEvent");
24306 res; res = res->next_sibling())
24308 deleted_event d = deleted_event::from_xml_element(*res);
24309 n.events.emplace_back(d);
24311 for (
auto res = notification_element->first_node_ns(
24312 uri<>::microsoft::types(),
"ModifiedEvent");
24313 res; res = res->next_sibling())
24315 modified_event d = modified_event::from_xml_element(*res);
24316 n.events.emplace_back(d);
24318 for (
auto res = notification_element->first_node_ns(
24319 uri<>::microsoft::types(),
"MovedEvent");
24320 res; res = res->next_sibling())
24322 moved_event m = moved_event::from_xml_element(*res);
24323 n.events.emplace_back(m);
24325 for (
auto res = notification_element->first_node_ns(
24326 uri<>::microsoft::types(),
"NewMailEvent");
24327 res; res = res->next_sibling())
24329 new_mail_event m = new_mail_event::from_xml_element(*res);
24330 n.events.emplace_back(m);
24332 for (
auto res = notification_element->first_node_ns(
24333 uri<>::microsoft::types(),
"FreeBusyChangedEvent");
24334 res; res = res->next_sibling())
24336 free_busy_changed_event f =
24337 free_busy_changed_event::from_xml_element(*res);
24338 n.events.emplace_back(f);
24342 return get_events_response_message(std::move(result), std::move(n));
24352 const std::string& name)
24371 if ( item_class ==
"" 24372 || item_class ==
"IPM.Note" 24373 || item_class ==
"IPM.Post" 24376 auto mime_content_node = props.get_node(
"MimeContent");
24380 auto& props = the_item.xml();
24383 #ifdef EWS_HAS_INITIALIZER_LISTS 24384 for (
const auto& property_name :
24386 {
"ItemId",
"ParentFolderId",
"DateTimeReceived",
"Size",
"IsSubmitted",
24387 "IsDraft",
"IsFromMe",
"IsResend",
"IsUnmodified",
"DateTimeSent",
24388 "DateTimeCreated",
"ResponseObjects",
"DisplayCc",
"DisplayTo",
24389 "HasAttachments",
"EffectiveRights",
"LastModifiedName",
24390 "LastModifiedTime",
"IsAssociated",
"WebClientReadFormQueryString",
24391 "WebClientEditFormQueryString",
"ConversationId",
"InstanceKey",
24394 "ConversationIndex",
"ConversationTopic"})
24396 std::vector<std::string> properties;
24399 properties.push_back(
"ItemId");
24400 properties.push_back(
"ParentFolderId");
24401 properties.push_back(
"DateTimeReceived");
24402 properties.push_back(
"Size");
24403 properties.push_back(
"IsSubmitted");
24404 properties.push_back(
"IsDraft");
24405 properties.push_back(
"IsFromMe");
24406 properties.push_back(
"IsResend");
24407 properties.push_back(
"IsUnmodified");
24408 properties.push_back(
"DateTimeSent");
24409 properties.push_back(
"DateTimeCreated");
24410 properties.push_back(
"ResponseObjects");
24411 properties.push_back(
"DisplayCc");
24412 properties.push_back(
"DisplayTo");
24413 properties.push_back(
"HasAttachments");
24414 properties.push_back(
"EffectiveRights");
24415 properties.push_back(
"LastModifiedName");
24416 properties.push_back(
"LastModifiedTime");
24417 properties.push_back(
"IsAssociated");
24418 properties.push_back(
"WebClientReadFormQueryString");
24419 properties.push_back(
"WebClientEditFormQueryString");
24420 properties.push_back(
"ConversationId");
24421 properties.push_back(
"InstanceKey");
24424 properties.push_back(
"ConversationIndex");
24425 properties.push_back(
"ConversationTopic");
24427 for (
const auto& property_name : properties)
24430 auto node = props.get_node(property_name);
24433 auto parent = node->parent();
24434 check(parent,
"Expected node to have a parent node");
24435 parent->remove_node(node);
24440 obj.type_ = type::item;
24442 using internal::create_node;
24443 auto& attachment_node =
24444 create_node(*obj.xml_.document(),
"t:ItemAttachment");
24445 create_node(attachment_node,
"t:Name", name);
24446 props.append_to(attachment_node);
24451 inline std::string delegate_user::delegate_permissions::to_xml()
const 24453 std::stringstream sstr;
24454 sstr <<
"<t:DelegatePermissions>";
24455 sstr <<
"<t:CalendarFolderPermissionLevel>" 24456 << internal::enum_to_str(calendar_folder)
24457 <<
"</t:CalendarFolderPermissionLevel>";
24459 sstr <<
"<t:TasksFolderPermissionLevel>" 24460 << internal::enum_to_str(tasks_folder)
24461 <<
"</t:TasksFolderPermissionLevel>";
24463 sstr <<
"<t:InboxFolderPermissionLevel>" 24464 << internal::enum_to_str(inbox_folder)
24465 <<
"</t:InboxFolderPermissionLevel>";
24467 sstr <<
"<t:ContactsFolderPermissionLevel>" 24468 << internal::enum_to_str(contacts_folder)
24469 <<
"</t:ContactsFolderPermissionLevel>";
24471 sstr <<
"<t:NotesFolderPermissionLevel>" 24472 << internal::enum_to_str(notes_folder)
24473 <<
"</t:NotesFolderPermissionLevel>";
24475 sstr <<
"<t:JournalFolderPermissionLevel>" 24476 << internal::enum_to_str(journal_folder)
24477 <<
"</t:JournalFolderPermissionLevel>";
24478 sstr <<
"</t:DelegatePermissions>";
24483 delegate_user::delegate_permissions::from_xml_element(
24484 const rapidxml::xml_node<char>& elem)
24486 using rapidxml::internal::compare;
24488 delegate_permissions perms;
24489 for (
auto node = elem.first_node(); node; node = node->next_sibling())
24491 if (compare(node->local_name(), node->local_name_size(),
24492 "CalendarFolderPermissionLevel",
24493 strlen(
"CalendarFolderPermissionLevel")))
24495 perms.calendar_folder = internal::str_to_permission_level(
24496 std::string(node->value(), node->value_size()));
24498 else if (compare(node->local_name(), node->local_name_size(),
24499 "TasksFolderPermissionLevel",
24500 strlen(
"TasksFolderPermissionLevel")))
24502 perms.tasks_folder = internal::str_to_permission_level(
24503 std::string(node->value(), node->value_size()));
24505 else if (compare(node->local_name(), node->local_name_size(),
24506 "InboxFolderPermissionLevel",
24507 strlen(
"InboxFolderPermissionLevel")))
24509 perms.inbox_folder = internal::str_to_permission_level(
24510 std::string(node->value(), node->value_size()));
24512 else if (compare(node->local_name(), node->local_name_size(),
24513 "ContactsFolderPermissionLevel",
24514 strlen(
"ContactsFolderPermissionLevel")))
24516 perms.contacts_folder = internal::str_to_permission_level(
24517 std::string(node->value(), node->value_size()));
24519 else if (compare(node->local_name(), node->local_name_size(),
24520 "NotesFolderPermissionLevel",
24521 strlen(
"NotesFolderPermissionLevel")))
24523 perms.notes_folder = internal::str_to_permission_level(
24524 std::string(node->value(), node->value_size()));
24526 else if (compare(node->local_name(), node->local_name_size(),
24527 "JournalFolderPermissionLevel",
24528 strlen(
"JournalFolderPermissionLevel")))
24530 perms.journal_folder = internal::str_to_permission_level(
24531 std::string(node->value(), node->value_size()));
24536 "Unexpected child element in <DelegatePermissions>");
24542 inline std::unique_ptr<recurrence_pattern>
24545 using rapidxml::internal::compare;
24546 using namespace internal;
24548 check(compare(elem.local_name(), elem.local_name_size(),
"Recurrence",
24549 strlen(
"Recurrence")),
24550 "Expected a <Recurrence> element");
24552 auto node = elem.first_node_ns(uri<>::microsoft::types(),
24553 "AbsoluteYearlyRecurrence");
24557 uint32_t day_of_month = 0U;
24559 for (
auto child = node->first_node(); child;
24560 child = child->next_sibling())
24562 if (compare(child->local_name(), child->local_name_size(),
"Month",
24565 mon = str_to_month(
24566 std::string(child->value(), child->value_size()));
24568 else if (compare(child->local_name(), child->local_name_size(),
24569 "DayOfMonth", strlen(
"DayOfMonth")))
24571 day_of_month = std::stoul(
24572 std::string(child->value(), child->value_size()));
24576 #ifdef EWS_HAS_MAKE_UNIQUE 24577 return std::make_unique<absolute_yearly_recurrence>(
24578 std::move(day_of_month), std::move(
mon));
24580 return std::unique_ptr<absolute_yearly_recurrence>(
24586 node = elem.first_node_ns(uri<>::microsoft::types(),
24587 "RelativeYearlyRecurrence");
24594 for (
auto child = node->first_node(); child;
24595 child = child->next_sibling())
24597 if (compare(child->local_name(), child->local_name_size(),
"Month",
24600 mon = str_to_month(
24601 std::string(child->value(), child->value_size()));
24603 else if (compare(child->local_name(), child->local_name_size(),
24604 "DayOfWeekIndex", strlen(
"DayOfWeekIndex")))
24606 index = str_to_day_of_week_index(
24607 std::string(child->value(), child->value_size()));
24609 else if (compare(child->local_name(), child->local_name_size(),
24610 "DaysOfWeek", strlen(
"DaysOfWeek")))
24612 days_of_week = str_to_day_of_week(
24613 std::string(child->value(), child->value_size()));
24617 #ifdef EWS_HAS_MAKE_UNIQUE 24618 return std::make_unique<relative_yearly_recurrence>(
24619 std::move(days_of_week), std::move(index), std::move(
mon));
24621 return std::unique_ptr<relative_yearly_recurrence>(
24623 std::move(index), std::move(
mon)));
24627 node = elem.first_node_ns(uri<>::microsoft::types(),
24628 "AbsoluteMonthlyRecurrence");
24631 uint32_t interval = 0U;
24632 uint32_t day_of_month = 0U;
24634 for (
auto child = node->first_node(); child;
24635 child = child->next_sibling())
24637 if (compare(child->local_name(), child->local_name_size(),
24638 "Interval", strlen(
"Interval")))
24640 interval = std::stoul(
24641 std::string(child->value(), child->value_size()));
24643 else if (compare(child->local_name(), child->local_name_size(),
24644 "DayOfMonth", strlen(
"DayOfMonth")))
24646 day_of_month = std::stoul(
24647 std::string(child->value(), child->value_size()));
24651 #ifdef EWS_HAS_MAKE_UNIQUE 24652 return std::make_unique<absolute_monthly_recurrence>(
24653 std::move(interval), std::move(day_of_month));
24655 return std::unique_ptr<absolute_monthly_recurrence>(
24657 std::move(day_of_month)));
24661 node = elem.first_node_ns(uri<>::microsoft::types(),
24662 "RelativeMonthlyRecurrence");
24665 uint32_t interval = 0U;
24669 for (
auto child = node->first_node(); child;
24670 child = child->next_sibling())
24672 if (compare(child->local_name(), child->local_name_size(),
24673 "Interval", strlen(
"Interval")))
24675 interval = std::stoul(
24676 std::string(child->value(), child->value_size()));
24678 else if (compare(child->local_name(), child->local_name_size(),
24679 "DaysOfWeek", strlen(
"DaysOfWeek")))
24681 days_of_week = str_to_day_of_week(
24682 std::string(child->value(), child->value_size()));
24684 else if (compare(child->local_name(), child->local_name_size(),
24685 "DayOfWeekIndex", strlen(
"DayOfWeekIndex")))
24687 index = str_to_day_of_week_index(
24688 std::string(child->value(), child->value_size()));
24692 #ifdef EWS_HAS_MAKE_UNIQUE 24693 return std::make_unique<relative_monthly_recurrence>(
24694 std::move(interval), std::move(days_of_week), std::move(index));
24696 return std::unique_ptr<relative_monthly_recurrence>(
24698 std::move(days_of_week),
24699 std::move(index)));
24703 node = elem.first_node_ns(uri<>::microsoft::types(),
"WeeklyRecurrence");
24706 uint32_t interval = 0U;
24707 auto days_of_week = std::vector<day_of_week>();
24710 for (
auto child = node->first_node(); child;
24711 child = child->next_sibling())
24713 if (compare(child->local_name(), child->local_name_size(),
24714 "Interval", strlen(
"Interval")))
24716 interval = std::stoul(
24717 std::string(child->value(), child->value_size()));
24719 else if (compare(child->local_name(), child->local_name_size(),
24720 "DaysOfWeek", strlen(
"DaysOfWeek")))
24723 std::string(child->value(), child->value_size());
24724 std::stringstream sstr(list);
24726 while (std::getline(sstr, temp,
' '))
24728 days_of_week.emplace_back(str_to_day_of_week(temp));
24731 else if (compare(child->local_name(), child->local_name_size(),
24732 "FirstDayOfWeek", strlen(
"FirstDayOfWeek")))
24734 first_day_of_week = str_to_day_of_week(
24735 std::string(child->value(), child->value_size()));
24739 #ifdef EWS_HAS_MAKE_UNIQUE 24740 return std::make_unique<weekly_recurrence>(
24741 std::move(interval), std::move(days_of_week),
24742 std::move(first_day_of_week));
24744 return std::unique_ptr<weekly_recurrence>(
24746 std::move(first_day_of_week)));
24750 node = elem.first_node_ns(uri<>::microsoft::types(),
"DailyRecurrence");
24753 uint32_t interval = 0U;
24755 for (
auto child = node->first_node(); child;
24756 child = child->next_sibling())
24758 if (compare(child->local_name(), child->local_name_size(),
24759 "Interval", strlen(
"Interval")))
24761 interval = std::stoul(
24762 std::string(child->value(), child->value_size()));
24766 #ifdef EWS_HAS_MAKE_UNIQUE 24767 return std::make_unique<daily_recurrence>(std::move(interval));
24769 return std::unique_ptr<daily_recurrence>(
24774 check(
false,
"Expected one of " 24775 "<AbsoluteYearlyRecurrence>, <RelativeYearlyRecurrence>, " 24776 "<AbsoluteMonthlyRecurrence>, <RelativeMonthlyRecurrence>, " 24777 "<WeeklyRecurrence>, <DailyRecurrence>");
24778 return std::unique_ptr<recurrence_pattern>();
24781 inline std::unique_ptr<recurrence_range>
24784 using rapidxml::internal::compare;
24786 check(compare(elem.local_name(), elem.local_name_size(),
"Recurrence",
24787 strlen(
"Recurrence")),
24788 "Expected a <Recurrence> element");
24790 auto node = elem.first_node_ns(internal::uri<>::microsoft::types(),
24791 "NoEndRecurrence");
24796 for (
auto child = node->first_node(); child;
24797 child = child->next_sibling())
24799 if (compare(child->local_name(), child->local_name_size(),
24800 "StartDate", strlen(
"StartDate")))
24803 date_time(std::string(child->value(), child->value_size()));
24807 #ifdef EWS_HAS_MAKE_UNIQUE 24808 return std::make_unique<no_end_recurrence_range>(std::move(start_date));
24810 return std::unique_ptr<no_end_recurrence_range>(
24815 node = elem.first_node_ns(internal::uri<>::microsoft::types(),
24816 "EndDateRecurrence");
24822 for (
auto child = node->first_node(); child;
24823 child = child->next_sibling())
24825 if (compare(child->local_name(), child->local_name_size(),
24826 "StartDate", strlen(
"StartDate")))
24829 date_time(std::string(child->value(), child->value_size()));
24831 else if (compare(child->local_name(), child->local_name_size(),
24832 "EndDate", strlen(
"EndDate")))
24835 date_time(std::string(child->value(), child->value_size()));
24839 #ifdef EWS_HAS_MAKE_UNIQUE 24840 return std::make_unique<end_date_recurrence_range>(
24841 std::move(start_date), std::move(end_date));
24843 return std::unique_ptr<end_date_recurrence_range>(
24845 std::move(end_date)));
24849 node = elem.first_node_ns(internal::uri<>::microsoft::types(),
24850 "NumberedRecurrence");
24854 uint32_t no_of_occurrences = 0U;
24856 for (
auto child = node->first_node(); child;
24857 child = child->next_sibling())
24859 if (compare(child->local_name(), child->local_name_size(),
24860 "StartDate", strlen(
"StartDate")))
24863 date_time(std::string(child->value(), child->value_size()));
24865 else if (compare(child->local_name(), child->local_name_size(),
24866 "NumberOfOccurrences",
24867 strlen(
"NumberOfOccurrences")))
24869 no_of_occurrences = std::stoul(
24870 std::string(child->value(), child->value_size()));
24874 #ifdef EWS_HAS_MAKE_UNIQUE 24875 return std::make_unique<numbered_recurrence_range>(
24876 std::move(start_date), std::move(no_of_occurrences));
24878 return std::unique_ptr<numbered_recurrence_range>(
24880 std::move(no_of_occurrences)));
24886 "<NoEndRecurrence>, <EndDateRecurrence>, <NumberedRecurrence>");
24887 return std::unique_ptr<recurrence_range>();
Indicates that the mailbox hold was not found.
std::vector< item_id > create_item(const std::vector< message > &messages, message_disposition disposition, const folder_id &folder)
Creates new messages in the specified folder.
Definition: ews.hpp:21514
A paged view of items in a folder.
Definition: ews.hpp:20332
This response code is not used.
This class allows HTTP basic authentication.
Definition: ews.hpp:8210
Represents the admin audit logs folder.
This error is intended for internal use only.
void set_categories(const std::vector< std::string > &categories)
Sets this item's categories.
Definition: ews.hpp:13758
Negates the boolean value of the search expression it contains.
Definition: ews.hpp:20178
Abstract base class for all recurrence ranges.
Definition: ews.hpp:17602
void set_sensitivity(sensitivity s)
Sets the sensitivity level of this item.
Definition: ews.hpp:13624
std::vector< calendar_item > get_calendar_items(const std::vector< item_id > &ids, const item_shape &shape=item_shape())
Gets a bunch of calendar items from the Exchange store at once.
Definition: ews.hpp:21102
std::string get_time_zone() const
Returns the display name for the time zone associated with this calendar item.
Definition: ews.hpp:18129
permission_level
Specifies the delegate permission-level settings for a user.
Definition: ews.hpp:14343
This error occurs when attempts to save the item or folder fail.
calendar_item_type
The CalendarItemType class represents an Exchange calendar item.
Definition: ews.hpp:6975
This error occurs when the mailbox quota is exceeded.
This error occurs when an invalid SID is passed in a request.
date_time get_date_time_created() const
Returns the date/time this item was created.
Definition: ews.hpp:13897
Specifies that the client was disconnected.
This error Indicates that a calendar item has been canceled.
Compare a property with a constant or another property.
Definition: ews.hpp:19922
item_id update_item(item_id id, update change, conflict_resolution resolution, send_meeting_invitations_or_cancellations invitations_or_cancellations, const folder_id &folder)
Update an existing item's property in the specified folder.
Definition: ews.hpp:21772
std::string get_net_show_url() const
Returns a URL for Microsoft NetShow online meeting.
Definition: ews.hpp:18422
static attachment from_item(const item &the_item, const std::string &name)
Creates a new <ItemAttachment> from a given item.
Definition: ews.hpp:24351
std::vector< item_id > create_item(const std::vector< contact > &contacts)
Creates new contacts from the given vector in the Exchange store.
Definition: ews.hpp:21366
Identifies individual members of a dictionary property by an URI and index.
Definition: ews.hpp:18880
int get_appointment_sequence_number() const
Returns the sequence number of this meetings version.
Definition: ews.hpp:18146
autodiscover_result get_exchange_web_services_url(const std::string &user_smtp_address, const basic_credentials &credentials)
Returns the EWS URL by querying the Autodiscover service.
Definition: ews.hpp:9142
The response will return the richest available content.
This error occurs if the offset for indexed paging is negative.
std::string to_xml() const
Serializes this item_id to an XML string.
Definition: ews.hpp:9216
const date_time & get_last_response_time() const EWS_NOEXCEPT
Returns the date and time of the latest response that was received.
Definition: ews.hpp:12758
void set_internet_message_id(const std::string &value)
Sets the Message-ID: header field of this email message.
Definition: ews.hpp:18645
std::string to_folder_xml() const
Serializes this update instance to an XML string for folder operations.
Definition: ews.hpp:20522
calendar_item(item_id id)
Creates a <CalendarItem> with given id.
Definition: ews.hpp:17829
Compare a property with a constant or another property.
Definition: ews.hpp:19961
task(item_id id)
Constructs a new task with the given item_id.
Definition: ews.hpp:14986
const date_time & get_proposed_end() const EWS_NOEXCEPT
Returns the date and time that was proposed as the end by the attendee.
Definition: ews.hpp:12779
Represents recurrence range with no end date.
Definition: ews.hpp:17659
std::string get_location() const
Returns the location where a meeting or event is supposed to take place.
Definition: ews.hpp:17923
This error must be returned when the server cannot empty a folder.
ssl_options
Definition: ews.hpp:20619
void set_net_show_url(const std::string &url)
Sets the URL for Microsoft NetShow online meeting.
Definition: ews.hpp:18432
search_scope
Identifies the order and scope for a ResolveNames search.
Definition: ews.hpp:7350
basic_service(const std::string &server_uri, const internal::credentials &creds, const std::string &cainfo, const std::string &capath, const std::string &proxy_uri, const bool is_http_proxy_tunneling, const debug_callback &callback, const ssl_options ssl_opts=ssl_options::none)
Constructs a new service with given credentials to a server specified by server_uri.
Definition: ews.hpp:20751
void set_subject(const std::string &subject)
Sets this item's subject. Limited to 255 characters.
Definition: ews.hpp:13604
This error occurs if the ReferenceItemId is missing.
This error occurs when the account in question has been disabled.
std::vector< std::string > get_companies() const
Returns the companies associated with this task.
Definition: ews.hpp:15060
Renders a <DistinguishedFolderId> element.
Definition: ews.hpp:9879
Represents the Favorites folder.
Allows you to express a boolean And operation between two search expressions.
Definition: ews.hpp:20121
The third occurrence of a day within a month.
bool none() const EWS_NOEXCEPT
True if this occurrence_info is undefined.
Definition: ews.hpp:17042
date_time get_complete_date() const
Returns the time the task was completed.
Definition: ews.hpp:15075
The Search Folders folder, also known as the Finder folder.
Represents a ConnectingSID element.
Definition: ews.hpp:20555
rapidxml::xml_node & to_xml_element(rapidxml::xml_node<> &parent) const
Creates a new XML element for this recurrence pattern and appends it to given parent node...
Definition: ews.hpp:17142
const std::string & field_uri() const EWS_NOEXCEPT
Returns the value of the <FieldURI> element.
Definition: ews.hpp:18772
void set_bcc_recipients(const std::vector< mailbox > &recipients)
Sets the recipients that will receive a blind carbon copy of the message to recipients.
Definition: ews.hpp:18592
The item has a normal sensitivity.
std::vector< mailbox > get_rooms(const mailbox &room_list)
Gets all rooms from a room list in the Exchange store.
Definition: ews.hpp:20977
date_time get_reminder_due_by() const
Returns the due date of this item.
Definition: ews.hpp:13917
Represents the IM contact list folder.
static calendar_item from_xml_element(const rapidxml::xml_node<> &elem)
Makes a calendar item instance from a <CalendarItem> XML element.
Definition: ews.hpp:18438
mailbox get_from() const
Returns the From: header field of this message.
Definition: ews.hpp:18603
void set_end(const date_time &datetime)
Sets the ending date and time for this calendar item.
Definition: ews.hpp:17857
importance
This enumeration indicates the importance of an item.
Definition: ews.hpp:7281
This error indicates that the ID and/or change key is malformed.
response_class
The ResponseClass attribute of a ResponseMessage.
Definition: ews.hpp:415
time_zone get_start_time_zone()
Returns the time zone for the starting date and time.
Definition: ews.hpp:18281
Represents a generic <Item> in the Exchange store.
Definition: ews.hpp:13550
Base-class for all exceptions thrown by this library.
Definition: ews.hpp:428
Represents a generic <Folder> in the Exchange store.
Definition: ews.hpp:13438
send_meeting_cancellations
Describes how a meeting will be canceled.
Definition: ews.hpp:6813
Raised when a response from a server could not be parsed.
Definition: ews.hpp:444
void set_time_zone(const time_zone time_zone)
Sets the time zone ID used in the header of the request made by this service.
Definition: ews.hpp:20810
This error occurs when the SavedItemFolderId is not found.
Contains all classes, functions, and enumerations of this library.
Definition: ews.hpp:83
void send_item(const std::vector< item_id > &ids)
Definition: ews.hpp:21529
The Deleted Items folder.
void set_reply_to(const std::vector< mailbox > &recipients)
Sets the addresses to which replies to this message should be sent.
Definition: ews.hpp:18679
This response code is not used.
This error occurs when a contact in your mailbox is corrupt.
The task is new and the request has been sent, but the delegate has no yet responded to the task...
void set_body(const body &b)
Sets the body of this item.
Definition: ews.hpp:13630
This response code is not used.
The comparison is between the string prefix and the constant.
This error indicates that the sharing message is not supported.
void set_resources(const std::vector< attendee > &resources) const
Sets the scheduled resources of this meeting.
Definition: ews.hpp:18073
item_id create_item(const contact &the_contact, const folder_id &folder)
Creates a new contact from the given object in the specified folder.
Definition: ews.hpp:21357
occurrence_item_id(const item_id &item_id, int instance_index)
Constructs an <OccurrenceItemId> from a given item_id instance.
Definition: ews.hpp:9278
paging_base_point
Defines the base point for paged searches with <FindItem> and <FindFolder>.
Definition: ews.hpp:5577
std::string get_meeting_workspace_url() const
Returns the URL for a meeting workspace.
Definition: ews.hpp:18406
This error indicates that a calendar item has been canceled.
void set_new_time_proposal_allowed(bool allowed)
If set to true, allows attendees to respond to the organizer with new time suggestions.
Definition: ews.hpp:18384
item_id update_item(item_id id, update change, conflict_resolution resolution=conflict_resolution::auto_resolve, send_meeting_invitations_or_cancellations invitations_or_cancellations=send_meeting_invitations_or_cancellations::send_to_none)
Update an existing item's property.
Definition: ews.hpp:21745
A weekly recurrence.
Definition: ews.hpp:17469
body_type
Specifies the type of a <Body> element.
Definition: ews.hpp:12573
The response type is unknown.
bool is_submitted() const
True if this item has been submitted for delivery.
Definition: ews.hpp:13820
void set_http_proxy_tunnel(const bool value)
Activate or deactivates HTTP proxy tunneling.
Definition: ews.hpp:20836
void set_start_time_zone(time_zone tz)
Sets the time zone for the starting date and time.
Definition: ews.hpp:18271
void delete_contact(contact &&the_contact)
Delete a contact from the Exchange store.
Definition: ews.hpp:21241
static user_id from_primary_smtp_address(std::string primary_smtp_address)
Creates a user_id from a given SMTP address.
Definition: ews.hpp:14202
occurrence_item_id(const item_id &item_id)
Constructs an <OccurrenceItemId> from a given item_id instance.
Definition: ews.hpp:9270
Specifies a time interval.
Definition: ews.hpp:12535
std::vector< mailbox > get_bcc_recipients() const
Returns the Bcc: recipients of this message.
Definition: ews.hpp:18582
This error occurs if you try to move a distinguished folder.
This error indicates that the destination folder does not exist.
The second occurrence of a day within a month.
The user doesn't have a valid license.
Compare a property with a constant or another property.
Definition: ews.hpp:20080
item_id move_item(item_id item, const folder_id &folder)
Moves one item to a folder.
Definition: ews.hpp:21867
date_time get_due_date() const
Returns the date that the task is due.
Definition: ews.hpp:15142
std::vector< item_id > create_item(const std::vector< calendar_item > &calendar_items, send_meeting_invitations send_invitations=send_meeting_invitations::send_to_none)
Creates new calendar items from the given vector in the Exchange store.
Definition: ews.hpp:21422
void set_location(const std::string &location)
Sets the location where a meeting or event is supposed to take place.
Definition: ews.hpp:17930
void set_start(const date_time &datetime)
Sets the starting date and time for this calendar item.
Definition: ews.hpp:17845
std::string content_id() const
Returns the attachement's content ID.
Definition: ews.hpp:11028
std::vector< folder > get_folders(const std::vector< folder_id > &ids)
Gets a list of folders from the Exchange store.
Definition: ews.hpp:21052
This response code is not used.
const item_id & root_item_id() const EWS_NOEXCEPT
Returns the item_id of the parent or root item.
Definition: ews.hpp:9388
This error indicates that there is a time zone error.
item_id create_item(const message &the_message, message_disposition disposition)
Creates a new message in the Exchange store.
Definition: ews.hpp:21460
extended_property(extended_field_uri ext_field_uri, std::vector< std::string > values)
Constructor to initialize an <ExtendedProperty> with the necessary values.
Definition: ews.hpp:13348
Target the schema files for Exchange 2010 Service Pack 1 (SP1)
std::vector< delegate_user > add_delegate(const mailbox &mailbox, const std::vector< delegate_user > &delegates)
Add new delegates to given mailbox.
Definition: ews.hpp:21909
folder_id create_folder(const folder &new_folder, const folder_id &parent_folder)
Create a new folder in the Exchange store.
Definition: ews.hpp:21282
bool valid() const EWS_NOEXCEPT
Whether this item_id is expected to be valid.
Definition: ews.hpp:9213
date_time get_date_time_received() const
Date/Time an item was received.
Definition: ews.hpp:13736
date_time get_date_time_sent() const
Returns the date/time this item was sent.
Definition: ews.hpp:13889
Describes a daily recurring event.
Definition: ews.hpp:17557
bool empty() const EWS_NOEXCEPT
Whether the resolution_set has no elements.
Definition: ews.hpp:9735
bool none() const EWS_NOEXCEPT
True if this mailbox is undefined.
Definition: ews.hpp:9484
std::vector< item_id > create_item(const std::vector< contact > &contacts, const folder_id &folder)
Creates new contacts from the given vector in the specified folder.
Definition: ews.hpp:21378
Specifies that there are duplicate SOAP headers.
This error occurs when the request stream is larger than 400 KB.
This response code is not used.
void set_display_name(const std::string &display_name)
Sets this folders display name.
Definition: ews.hpp:13467
Check if a text property contains a sub-string.
Definition: ews.hpp:20296
int get_percent_complete() const
Returns the percentage of the task that has been completed.
Definition: ews.hpp:15212
std::vector< item_id > create_item(const std::vector< task > &tasks, const folder_id &folder)
Creates new tasks from the given vector in the the specified folder.
Definition: ews.hpp:21335
This error MUST be returned when event notifications are missed.
containment_comparison
This enumeration determines how case and non-spacing characters are considered when evaluating a text...
Definition: ews.hpp:20257
void set_culture(const std::string &culture)
Sets the culture name associated with the body of this item.
Definition: ews.hpp:14048
This response code is not used.
void set_meeting_time_zone(time_zone tz)
Sets the time zone for the meeting date and time.
Definition: ews.hpp:18323
This error occurs when the SMTP address cannot be parsed.
occurrence_info get_first_occurrence() const
Returns the first occurrence.
Definition: ews.hpp:18211
bool meeting_request_was_sent() const
True if a meeting request for this calendar item has been sent to all attendees.
Definition: ews.hpp:17975
This response code is not used.
delete_type
Describes how items are deleted from the Exchange store.
Definition: ews.hpp:6712
Exception for libcurl related runtime errors.
Definition: ews.hpp:7710
A message item in the Exchange store.
Definition: ews.hpp:18506
std::string get_mime_content() const
Returns the attachment's mime content.
Definition: ews.hpp:10964
Compare a property with a constant or another property.
Definition: ews.hpp:20000
Represents a numbered recurrence range.
Definition: ews.hpp:17760
int get_conference_type() const
Returns the type of conferencing that is performed with this calendar item.
Definition: ews.hpp:18356
occurrence_info get_last_occurrence() const
Returns the last occurrence.
Definition: ews.hpp:18222
bool is_recurring() const
True if the task is recurring.
Definition: ews.hpp:15172
conflict_resolution
The type of conflict resolution to try during an UpdateItem method call.
Definition: ews.hpp:6852
bool get_receive_copies_of_meeting_messages() const EWS_NOEXCEPT
Returns whether this delegate receives copies of meeting-related messages that are addressed to the o...
Definition: ews.hpp:14411
std::vector< mailbox > get_to_recipients() const
Returns the recipients of this message.
Definition: ews.hpp:18551
std::string to_xml() const
Serializes this occurrence_item_id to an XML string.
Definition: ews.hpp:9306
void set_cainfo(const std::string &path)
Sets the path to file holding certificates.
Definition: ews.hpp:20858
std::string get_subject() const
Returns this item's subject.
Definition: ews.hpp:13610
static task from_xml_element(const rapidxml::xml_node<> &elem)
Makes a task instance from a <Task> XML element.
Definition: ews.hpp:15316
This response code is not used.
resolution_set resolve_names(const std::string &unresolved_entry, search_scope scope, const std::vector< folder_id > &parent_folder_ids)
The ResolveNames operation resolves ambiguous email addresses and display names.
Definition: ews.hpp:22108
Indicates that the item was invalid for an ArchiveItem operation.
This error is intended for internal use only.
Compare a property with a constant or another property.
Definition: ews.hpp:19878
Represents the directory folder.
const std::string & error_details() const EWS_NOEXCEPT
More detailed information about the error.
Definition: ews.hpp:7724
std::vector< std::string > get_contacts() const
Returns a list of contacts associated with this task.
Definition: ews.hpp:15081
operation
Definition: ews.hpp:20459
Identifies frequently referenced properties by an URI.
Definition: ews.hpp:18750
const std::string & routing_type() const EWS_NOEXCEPT
Returns the routing type.
Definition: ews.hpp:9500
void set_when(const std::string &desc)
Sets a description of when this calendar item occurs.
Definition: ews.hpp:17939
const std::string & id() const EWS_NOEXCEPT
Definition: ews.hpp:9378
Represents a concrete task in the Exchange store.
Definition: ews.hpp:14976
std::vector< std::string > get_categories() const
Returns the categories associated with this item.
Definition: ews.hpp:13776
const char * bytes() const EWS_NOEXCEPT
Note: the pointer to the data is not 0-terminated.
Definition: ews.hpp:12696
calendar_item_type get_calendar_item_type() const
Returns the type of this calendar item.
Definition: ews.hpp:17991
free_busy_status
Gets the free/busy status that is associated with the event.
Definition: ews.hpp:6923
This error indicates that mail tips are disabled.
std::string get_display_to() const
Returns a nice string containing all To: recipients of this item.
Definition: ews.hpp:13968
std::vector< folder_id > move_folder(const std::vector< folder_id > &folders, const folder_id &target)
Moves one or more folders to a target folder.
Definition: ews.hpp:21901
folder_id move_folder(folder_id folder, const folder_id &target)
Moves one folder to a folder.
Definition: ews.hpp:21890
This error occurs when a list with added delegates cannot be saved.
Abstract base class for all recurrence patterns.
Definition: ews.hpp:17117
This response code is not used.
std::vector< item_id > find_item(const folder_id &parent_folder_id, search_expression restriction)
Sends a <FindItem/> operation to the server.
Definition: ews.hpp:21705
void set_timeout(std::chrono::seconds d)
Sets maximum time the request is allowed to take.
Definition: ews.hpp:20823
This response code is not used.
static item_id from_xml_element(const rapidxml::xml_node<> &elem)
Makes an item_id instance from an <ItemId> XML element.
Definition: ews.hpp:9223
This error is intended for internal use only.
time_zone get_meeting_time_zone()
Returns the time zone for the meeting date and time.
Definition: ews.hpp:18333
This error indicates that a calendar item has been canceled.
This response code is not used.
std::vector< mailbox > get_reply_to() const
Returns the Reply-To: address list of this message.
Definition: ews.hpp:18669
Only the Active Directory directory service is searched.
The message per folder receive quota has been exceeded.
void set_optional_attendees(const std::vector< attendee > &attendees) const
Sets the attendees not required to attend this meeting.
Definition: ews.hpp:18061
This response code is not used.
std::vector< folder > get_folders(const std::vector< folder_id > &ids, const std::vector< property_path > &additional_properties)
Gets a list of folders from Exchange store.
Definition: ews.hpp:21059
The comparison is between a prefix on individual words in the string and the constant.
std::string get_internet_message_id() const
Returns the Message-ID: header field of this email message.
Definition: ews.hpp:18631
folder get_folder(const folder_id &id, const std::vector< property_path > &additional_properties)
Gets a folder from the Exchange store.
Definition: ews.hpp:21044
void set_reminder_due_by(const date_time &due_by)
Sets the due date of this item.
Definition: ews.hpp:13909
This error is intended for internal use only.
time_zone get_end_time_zone()
Returns the time zone for the ending date and time.
Definition: ews.hpp:18307
distinguished_folder_id(standard_folder folder, mailbox owner)
Constructor for EWS delegate access.
Definition: ews.hpp:9915
The quick contacts folder.
message_disposition
<CreateItem> and <UpdateItem> methods use this attribute. Only applicable to email messages ...
Definition: ews.hpp:6890
std::vector< delegate_user > get_delegate(const mailbox &mailbox, bool include_permissions=false)
Retrieves the delegate users and settings for the specified mailbox.
Definition: ews.hpp:21935
void set_debug_callback(const debug_callback &callback)
Sets the callback for debug messages.
Definition: ews.hpp:20876
Raised when an assertion fails.
Definition: ews.hpp:436
base_shape
Specifies the set of properties that a GetItem or GetFolder method call will return.
Definition: ews.hpp:6675
contact get_contact(const item_id &id, const item_shape &shape=item_shape())
Gets a contact from the Exchange store.
Definition: ews.hpp:21080
bool is_meeting() const
Indicates whether this calendar item is a meeting.
Definition: ews.hpp:17947
static attachment from_base64(const std::string &content, std::string content_type, std::string name)
Creates a new <FileAttachment> from a given base64 string.
Definition: ews.hpp:11112
Represents a single delegate.
Definition: ews.hpp:14339
This error is intended for internal use only.
Exception thrown when a HTTP request was not successful.
Definition: ews.hpp:7650
bool is_response_requested() const
Indicates whether a response to a calendar item is needed.
Definition: ews.hpp:17983
body(std::string content, body_type type=body_type::plain_text)
Creates a new body element with given content and type.
Definition: ews.hpp:12618
bool has_attachments() const
True if this item has non-hidden attachments.
Definition: ews.hpp:13976
sync_folder_hierarchy_result sync_folder_hierarchy(const folder_id &folder_id)
Synchronizes the folder hierarchy in the Exchange store.
Definition: ews.hpp:21000
month
Describes the month when a yearly recurring item occurs.
Definition: ews.hpp:14653
const std::string & change_key() const EWS_NOEXCEPT
Returns the change key.
Definition: ews.hpp:9210
date_time get_start_date() const
Returns the date that work on the task should start.
Definition: ews.hpp:15244
std::string content() const
Returns the attachment's contents.
Definition: ews.hpp:11002
The item is removed immediately from the user's mailbox.
response_code
Response code enum describes status information about a request.
Definition: ews.hpp:548
std::vector< task > get_tasks(const std::vector< item_id > &ids, const item_shape &shape=item_shape())
Gets multiple tasks from the Exchange store.
Definition: ews.hpp:21073
void set_start_date(const date_time &start_date)
Set the date that work on the task should start.
Definition: ews.hpp:15238
This response code is not used.
void set_ssl_options(const ssl_options value)
Sets the SSL options.
Definition: ews.hpp:20870
Represents a <FileAttachment> or an <ItemAttachment>
Definition: ews.hpp:10925
attachment get_attachment(const attachment_id &id, bool include_mime_content=false)
Retrieves an attachment from the Exchange store.
Definition: ews.hpp:22029
static date_time from_epoch(time_t epoch)
Definition: ews.hpp:12427
const std::string & change_key() const EWS_NOEXCEPT
Returns the change key.
Definition: ews.hpp:9297
The unique identifier and change key of an item in the Exchange store.
Definition: ews.hpp:9186
free_busy_status get_legacy_free_busy_status() const
Returns the free/busy status of this calendar item.
Definition: ews.hpp:17883
item_id create_item(const calendar_item &the_calendar_item, send_meeting_invitations send_invitations=send_meeting_invitations::send_to_none)
Creates a new calendar item from the given object in the Exchange store.
Definition: ews.hpp:21391
Definition: ews.hpp:14138
Allows you to express a logical Or operation between two search expressions.
Definition: ews.hpp:20150
This error is for internal use only. This error is not returned.
Indicates an organizer response type.
bool is_resend() const
True if this item a re-send.
Definition: ews.hpp:13844
Represents the actual content of a message.
Definition: ews.hpp:12611
This error occurs if the object type changed.
This error is intended for internal use only.
std::string name() const
Returns the attachment's name.
Definition: ews.hpp:10952
std::vector< folder_id > find_folder(const folder_id &parent_folder_id)
Sends a <FindFolder/> operation to the server.
Definition: ews.hpp:21602
Indicates that the extension was not found.
Non-spacing characters will be ignored during comparison.
Target the schema files for Exchange 2010.
std::vector< item_id > create_item(const std::vector< message > &messages, message_disposition disposition)
Creates new messages in the Exchange store.
Definition: ews.hpp:21498
This response code is not used.
calendar_item get_calendar_item(const item_id &id, const item_shape &shape=item_shape())
Gets a calendar item from the Exchange store.
Definition: ews.hpp:21094
The item is confidential.
The task was declined by the delegate.
This error indicates that a calendar item has been canceled.
distinguished_folder_id(standard_folder folder, std::string change_key)
Creates a <DistinguishedFolderId> element for a given well-known folder and change key...
Definition: ews.hpp:9897
This response code is not used.
static extended_field_uri from_xml_element(const rapidxml::xml_node<> &elem)
Converts an xml string into a extended_field_uri property.
Definition: ews.hpp:13139
The conversation history folder.
Definition: ews.hpp:14361
item_id create_item(const message &the_message, message_disposition disposition, const folder_id &folder)
Creates a new message in the specified folder.
Definition: ews.hpp:21476
int get_appointment_state() const
Returns the status of this meeting.
Definition: ews.hpp:18165
This error indicates that the given domain cannot be found.
response_type get_my_response_type() const
Returns the response of this calendar item's owner to the meeting.
Definition: ews.hpp:18018
bool valid() const EWS_NOEXCEPT
Whether this attachment_id is valid.
Definition: ews.hpp:9391
message()
Constructs a new message object.
Definition: ews.hpp:18513
int instance_index() const EWS_NOEXCEPT
Returns the instance index.
Definition: ews.hpp:9300
This error is for internal use only. This error is not returned.
Compare a property with a constant or another property.
Definition: ews.hpp:20041
Target the schema files for Exchange 2013 Service Pack 1 (SP1)
The root of the folder hierarchy in the archive mailbox.
Identifies a folder.
Definition: ews.hpp:9800
Return only the item or folder ID.
bool is_complete() const
True if the task is marked as complete.
Definition: ews.hpp:15166
std::vector< folder_id > create_folder(const std::vector< folder > &new_folders, const folder_id &parent_folder)
Create a new folder in the Exchange store.
Definition: ews.hpp:21294
void delete_message(message &&the_message)
Delete a message item from the Exchange store.
Definition: ews.hpp:21259
This error occurs when the MIME content is invalid.
An event that occurs annually relative to a month, week, and day.
Definition: ews.hpp:17393
This class allows NTLM authentication.
Definition: ews.hpp:8235
const mailbox & get_mailbox() const EWS_NOEXCEPT
Returns this attendee's email address.
Definition: ews.hpp:12743
This error occurs when the server is busy.
std::vector< mailbox > get_cc_recipients() const
Returns the Cc: recipients of this message.
Definition: ews.hpp:18566
void set_up() EWS_NOEXCEPT
Definition: ews.hpp:9121
item()
Constructs a new item.
Definition: ews.hpp:13557
day_of_week
Describes working days.
Definition: ews.hpp:14787
void delete_task(task &&the_task, delete_type del_type=delete_type::hard_delete, affected_task_occurrences affected=affected_task_occurrences::all_occurrences)
Delete a task item from the Exchange store.
Definition: ews.hpp:21231
standard_folder
Well known folder names enumeration. Usually rendered to XML as <DistinguishedFolderId> element...
Definition: ews.hpp:7068
const std::string & value() const EWS_NOEXCEPT
Returns the email address.
Definition: ews.hpp:9490
bool is_team_task() const
True if the task is a team task.
Definition: ews.hpp:15180
void set_capath(const std::string &path)
Sets the path to the certificates directory.
Definition: ews.hpp:20864
std::string to_item_xml() const
Serializes this update instance to an XML string for item operations.
Definition: ews.hpp:20503
mime_content(std::string charset, const char *const ptr, size_t len)
Copies len bytes from ptr into an internal buffer.
Definition: ews.hpp:12687
bool is_inline() const
Returns true if the attachment is inlined.
Definition: ews.hpp:11035
Exception thrown when a request was not successful.
Definition: ews.hpp:7508
void set_importance(importance i)
Sets the importance of the item.
Definition: ews.hpp:13795
size_t get_size() const
Size in bytes of an item.
Definition: ews.hpp:13745
Apply an operation only to the specified occurrence.
This response code is not used.
The item is an occurrence of a recurring calendar item.
void set_last_response_time(const date_time &time)
Sets the date and time fo the latest response that was received.
Definition: ews.hpp:12764
Base-class for all search expressions.
Definition: ews.hpp:19762
void tear_down() EWS_NOEXCEPT
Definition: ews.hpp:9129
This response code is not used.
void send_item(const item_id &id)
Definition: ews.hpp:21524
delegation_state
Describes the state of a delegated task.
Definition: ews.hpp:14564
folder get_folder(const folder_id &id)
Gets a folder from the Exchange store.
Definition: ews.hpp:21038
std::string get_culture() const
Returns the culture name associated with the body of this item.
Definition: ews.hpp:14054
std::vector< internet_message_header > get_internet_message_headers() const
Returns a collection of Internet message headers associated with this item.
Definition: ews.hpp:13863
date_time get_end() const
Returns the ending date and time for this calendar item.
Definition: ews.hpp:17851
static std::string well_known_name(standard_folder enumeration)
Returns the well-known name for given standard_folder as string.
Definition: ews.hpp:10092
std::vector< attendee > get_required_attendees() const
Returns all attendees required to attend this meeting.
Definition: ews.hpp:18043
std::vector< occurrence_info > get_modified_occurrences() const
Returns the modified occurrences.
Definition: ews.hpp:18233
The task is waiting on other.
This response code is not used.
A SOAP fault occurred due to a bad request.
Definition: ews.hpp:7667
const std::string & mailbox_type() const EWS_NOEXCEPT
Returns the mailbox type.
Definition: ews.hpp:9508
send_meeting_invitations_or_cancellations
Describes how attendees will be updated when a meeting changes.
Definition: ews.hpp:6764
bool is_online_meeting() const
Returns whether this meeting is held online.
Definition: ews.hpp:18390
Represents a calendar item in the Exchange store.
Definition: ews.hpp:17819
exchange_error(response_code code)
Constructs an exchange_error from a <ResponseCode>.
Definition: ews.hpp:7512
bool is_unmodified() const
True if this item is unmodified.
Definition: ews.hpp:13852
static std::unique_ptr< recurrence_range > from_xml_element(const rapidxml::xml_node<> &elem)
Makes a recurrence_range instance from a <Recurrence> XML element.
Definition: ews.hpp:24782
static attachment from_file(const std::string &file_path, std::string content_type, std::string name)
Creates a new <FileAttachment> from a given file.
Definition: ews.hpp:11144
folder_id update_folder(folder_id folder_id, update change)
Update an existing folder's property.
Definition: ews.hpp:21841
Return (nearly) all properties.
const std::string & name() const EWS_NOEXCEPT
Returns the name of the mailbox user.
Definition: ews.hpp:9495
Represents the people connect folder.
Target the schema files for Exchange 2013.
rapidxml::xml_node & to_xml_element(rapidxml::xml_node<> &parent) const
Creates a new XML element for this recurrence range and appends it to given parent node...
Definition: ews.hpp:17626
std::vector< calendar_item > find_item(const calendar_view &view, const folder_id &parent_folder_id, const item_shape &shape=item_shape())
Returns all calendar items in given calendar view.
Definition: ews.hpp:21673
Contains the unique identifier of an attachment.
Definition: ews.hpp:9358
A thin wrapper around xs:dateTime formatted strings.
Definition: ews.hpp:12290
std::pair< std::unique_ptr< recurrence_pattern >, std::unique_ptr< recurrence_range > > get_recurrence() const
Returns the recurrence pattern for calendar items and meeting requests.
Definition: ews.hpp:18178
Return the default set of properties.
mailbox get_sender() const
Returns the Sender: header field of this message.
Definition: ews.hpp:18527
void set_end_time_zone(time_zone tz)
Sets the time zone of the ending date and time.
Definition: ews.hpp:18297
bool is_draft() const
True if this item is a draft.
Definition: ews.hpp:13828
The response will return an item body as HTML.
This response code is not used.
body()
Creates an empty body element; body_type is plain-text.
Definition: ews.hpp:12615
The OccurrenceItemId element identifies a single occurrence of a recurring item.
Definition: ews.hpp:9252
void set_contacts(const std::vector< std::string > &contacts)
Sets the contacts associated with this task to contacts.
Definition: ews.hpp:15087
Renders an <ItemShape> element.
Definition: ews.hpp:19579
The recipient cache folder.
Indicates that the archive mailbox was not enabled.
static attachment from_xml_element(const rapidxml::xml_node<> &elem)
Constructs an attachment from a given XML element elem.
Definition: ews.hpp:11086
mime_content get_mime_content() const
Base64-encoded contents of the MIME stream of this item.
Definition: ews.hpp:13573
std::vector< attendee > get_optional_attendees() const
Returns all attendees not required to attend this meeting.
Definition: ews.hpp:18055
The comparison is case-insensitive.
item_id update_item(item_id id, const std::vector< update > &changes, conflict_resolution resolution=conflict_resolution::auto_resolve, send_meeting_invitations_or_cancellations invitations_or_cancellations=send_meeting_invitations_or_cancellations::send_to_none)
Update multiple properties of an existing item.
Definition: ews.hpp:21795
A range view of appointments in a calendar.
Definition: ews.hpp:20396
This response code is not used.
std::string get_delegator() const
Returns the name of the user that delegated the task.
Definition: ews.hpp:15130
bool is_reminder_enabled() const
True if a reminder has been enabled on this item.
Definition: ews.hpp:13929
item_id(std::string id)
Constructs an <ItemId> from given id string.
Definition: ews.hpp:9197
basic_service(const std::string &server_uri, const internal::credentials &creds)
Constructs a new service with given credentials to a server specified by server_uri.
Definition: ews.hpp:20739
std::vector< item_id > move_item(const std::vector< item_id > &items, const folder_id &folder)
Moves one or more items to a folder.
Definition: ews.hpp:21878
void set_response_type(response_type type)
Sets the atteendee's response.
Definition: ews.hpp:12755
int get_adjacent_meeting_count() const
Returns the number of meetings that are adjacent to this meeting.
Definition: ews.hpp:18098
static occurrence_item_id from_xml_element(const rapidxml::xml_node<> &elem)
Definition: ews.hpp:9317
const std::string & change_key() const EWS_NOEXCEPT
Returns a string identifying a version of a folder.
Definition: ews.hpp:9825
void set_cc_recipients(const std::vector< mailbox > &recipients)
Sets the recipients that will receive a carbon copy of the message to recipients. ...
Definition: ews.hpp:18576
This response code is not used.
Definition: ews.hpp:15896
attachment_id create_attachment(const item_id &parent_item, const attachment &a)
Lets you attach a file (or another item) to an existing item.
Definition: ews.hpp:21984
folder_id get_parent_folder_id() const
Returns a unique identifier for the folder that contains this item.
Definition: ews.hpp:13590
static attendee from_xml_element(const rapidxml::xml_node<> &elem)
Makes a attendee instance from an <Attendee> XML element.
Definition: ews.hpp:12853
This response code is not used.
date_time date
A xs:date formatted string.
Definition: ews.hpp:12517
occurrence_item_id(std::string id, std::string change_key, int instance_index)
Constructs an <OccurrenceItemId> from given identifier and change key.
Definition: ews.hpp:9286
void set_actual_work(int actual_work)
Sets the actual amount of work expended on the task.
Definition: ews.hpp:15011
type
Describes whether an attachment contains a file or another item.
Definition: ews.hpp:10933
The fourth occurrence of a day within a month.
std::string get_item_class() const
Returns the PR_MESSAGE_CLASS MAPI property (the message class) for an item.
Definition: ews.hpp:13598
void set_mileage(const std::string &mileage)
Sets the mileage associated with the task.
Definition: ews.hpp:15194
std::string get_display_name() const
Returns this folders display name.
Definition: ews.hpp:13461
This error code is never returned.
sensitivity
This enumeration indicates the sensitivity of an item.
Definition: ews.hpp:7222
Access to items is prohibited.
A SOAP fault that is raised when we sent invalid XML.
Definition: ews.hpp:7683
body get_body() const
Returns the body of this item.
Definition: ews.hpp:13659
std::string get_status_description() const
Returns the status description.
Definition: ews.hpp:15289
std::string to_xml(const char *xmlns="t") const
Returns the XML serialized string of this mailbox.
Definition: ews.hpp:9522
int get_actual_work() const
Returns the actual amount of work expended on the task.
Definition: ews.hpp:14998
A yearly recurrence pattern, e.g., a birthday.
Definition: ews.hpp:17248
Allows you to perform operations on an Exchange server.
Definition: ews.hpp:20712
An attendee of a meeting or a meeting room.
Definition: ews.hpp:12727
This response code is not used.
Represents the My Contacts folder.
void delete_folder(const folder_id &id, delete_type del_type=delete_type::hard_delete)
Delete a folder from the Exchange store.
Definition: ews.hpp:21173
bool valid() const EWS_NOEXCEPT
Whether this item_id is expected to be valid.
Definition: ews.hpp:9303
sensitivity get_sensitivity() const
Returns the sensitivity level of this item.
Definition: ews.hpp:13616
int get_total_work() const
Returns the total amount of work for this task.
Definition: ews.hpp:15295
static attachment_id from_xml_element(const rapidxml::xml_node<> &elem)
Makes an attachment_id instance from an <AttachmentId> element.
Definition: ews.hpp:9408
This response code is not used.
status
Specifies the status of a task item.
Definition: ews.hpp:14612
const std::string & id() const EWS_NOEXCEPT
Returns the identifier.
Definition: ews.hpp:9294
std::string get_display_cc() const
Returns a nice string containing all Cc: recipients of this item.
Definition: ews.hpp:13957
Definition: ews.hpp:15561
This error is caused by an invalid watermark.
This error MUST be returned if any rule does not validate.
Following are folders containing recoverable items:
date_time get_start() const
Returns the starting date and time for this calendar item.
Definition: ews.hpp:17839
static folder_id from_xml_element(const rapidxml::xml_node<> &elem)
Makes a folder_id instance from given XML element.
Definition: ews.hpp:9831
void set_due_date(const date_time &due_date)
Sets the date that the task is due.
Definition: ews.hpp:15136
void set_to_recipients(const std::vector< mailbox > &recipients)
Sets the recipients of this message to recipients.
Definition: ews.hpp:18560
uint32_t get_reminder_minutes_before_start() const
Returns the number of minutes before due date that a reminder should be shown to the user...
Definition: ews.hpp:13944
void set_companies(const std::vector< std::string > &companies)
Sets the companies associated with this task.
Definition: ews.hpp:15069
server_version
Defines the different values for the <RequestServerVersion> element.
Definition: ews.hpp:6583
This error is intended for internal use only.
This response code is not used.
const std::string & to_xml() const EWS_NOEXCEPT
Serializes this ConnectingSID instance to an XML string.
Definition: ews.hpp:20574
int get_conflicting_meeting_count() const
Returns the number of meetings that are in conflict with this meeting.
Definition: ews.hpp:18085
Definition: ews.hpp:16001
std::vector< mailbox > get_room_lists()
Gets all room lists in the Exchange store.
Definition: ews.hpp:20962
This error indicates that the requester is not enabled.
No error occurred for the request.
void set_all_day_event_enabled(bool enabled)
Makes this calendar item an all day event or not.
Definition: ews.hpp:17877
distinguished_folder_id(standard_folder folder)
Creates a <DistinguishedFolderId> element for a given well-known folder.
Definition: ews.hpp:9890
std::vector< calendar_item > get_calendar_items(const std::vector< occurrence_item_id > &ids, const item_shape &shape=item_shape())
Gets a bunch of calendar items from the Exchange store at once.
Definition: ews.hpp:21131
bool is_all_day_event() const
True if this calendar item is lasting all day.
Definition: ews.hpp:17871
folder()
Constructs a new folder.
Definition: ews.hpp:13445
bool is_new_time_proposal_allowed() const
Returns true if attendees are allowed to respond to the organizer with new time suggestions.
Definition: ews.hpp:18373
bool get_view_private_items() const EWS_NOEXCEPT
Returns whether this delegate is allowed to view private items in the owner's mailbox.
Definition: ews.hpp:14418
static standard_folder str_to_standard_folder(const std::string &name)
Returns the standard_folder enum for given string.
Definition: ews.hpp:9921
void delete_calendar_item(calendar_item &&the_calendar_item, delete_type del_type=delete_type::hard_delete, send_meeting_cancellations cancellations=send_meeting_cancellations::send_to_none)
Delete a calendar item from the Exchange store.
Definition: ews.hpp:21248
This response code is not used.
attachment_id id() const
Returns this attachment's attachment_id.
Definition: ews.hpp:10945
const std::string & violation() const EWS_NOEXCEPT
A more detailed explanation of what went wrong.
Definition: ews.hpp:7701
This response code is not used.
item_id create_item(const task &the_task, const folder_id &folder)
Creates a new task from the given object in the the specified folder.
Definition: ews.hpp:21315
The root of the message folder hierarchy in the archive mailbox.
std::vector< contact > get_contacts(const std::vector< item_id > &ids, const item_shape &shape=item_shape())
Gets multiple contacts from the Exchange store.
Definition: ews.hpp:21087
The Deleted Items folder in the archive mailbox.
rapidxml::xml_node & to_xml_element(rapidxml::xml_node<> &parent) const
Creates a new <Mailbox> XML element and appends it to given parent node.
Definition: ews.hpp:9559
sync_folder_items_result sync_folder_items(const folder_id &folder_id, int max_changes_returned=512)
Synchronizes a folder in the Exchange store.
Definition: ews.hpp:21013
std::string to_xml() const
Returns this attachment serialized to XML.
Definition: ews.hpp:11083
Definition: ews.hpp:15450
std::string get_in_reply_to() const
Returns the identifier of the item to which this item is a reply.
Definition: ews.hpp:13812
Indicates an error in archive folder path creation.
item_id create_item(const calendar_item &the_calendar_item, send_meeting_invitations send_invitations, const folder_id &folder)
Creates a new calendar item from the given object in the specified folder.
Definition: ews.hpp:21407
std::vector< attachment > get_attachments() const
Returns the items or files that are attached to this item.
Definition: ews.hpp:13714
void set_conference_type(int value)
Sets the type of conferencing that is performed with this calendar item.
Definition: ews.hpp:18366
bool is_read() const
Returns whether this message has been read.
Definition: ews.hpp:18651
int get_total_count() const
Returns the total number of items in this folder.
Definition: ews.hpp:13473
The task was accepted by the delegate.
void delete_item(const item_id &id, delete_type del_type=delete_type::hard_delete, affected_task_occurrences affected=affected_task_occurrences::all_occurrences, send_meeting_cancellations cancellations=send_meeting_cancellations::send_to_none)
Delete an arbitrary item from the Exchange store.
Definition: ews.hpp:21196
The tenant is marked for removal.
The task is not a delegated task, or the task request has been created but not sent.
The last occurrence of a day within a month.
int get_change_count() const
Returns the change count of this task.
Definition: ews.hpp:15044
void set_proposed_start(const date_time &start)
Sets the start date and time that was proposed by the attendee.
Definition: ews.hpp:12776
size_t write_content_to_file(const std::string &file_path) const
Write contents to a file.
Definition: ews.hpp:11055
std::string to_xml()
Returns a string representation of this extended_field_uri.
Definition: ews.hpp:13104
bool is_recurring() const
True if a calendar item is part of a recurring series.
Definition: ews.hpp:17966
static user_id from_sid(std::string sid)
Creates a user_id from a given SID.
Definition: ews.hpp:14209
std::vector< resolution >::iterator end()
Range-based for loop support.
Definition: ews.hpp:9741
std::string get_billing_information() const
Returns the billing information associated with this task.
Definition: ews.hpp:15027
std::vector< occurrence_info > get_deleted_occurrences() const
Returns the deleted occurrences.
Definition: ews.hpp:18252
Holds a subset of properties from an existing calendar item.
Definition: ews.hpp:17025
affected_task_occurrences
Indicates which occurrences of a recurring series should be deleted.
Definition: ews.hpp:6738
int get_child_folder_count() const
Returns the number of child folders in this folder.
Definition: ews.hpp:13479
folder_id get_parent_folder_id() const
Returns the id of the parent folder.
Definition: ews.hpp:13485
The comparison is between a sub-string of the string and the constant.
Apply an operation to all occurrences in the series.
time_zone
Represents the unique identifiers of the time zones. These IDs are specific to windows and differ fro...
Definition: ews.hpp:5606
Represents recurrence range with end date.
Definition: ews.hpp:17707
date_time get_assigned_time() const
Returns the time this task was assigned to the current owner.
Definition: ews.hpp:15021
duration get_duration() const
Returns the duration of this meeting.
Definition: ews.hpp:18111
The first occurrence of a day within a month.
response_type get_response_type() const EWS_NOEXCEPT
Returns this attendee's response.
Definition: ews.hpp:12749
void set_billing_information(const std::string &billing_info)
Sets the billing information associated with this task.
Definition: ews.hpp:15033
const std::vector< std::string > & get_values() const EWS_NOEXCEPT
Returns the values of the extended_property as a vector even it is just one.
Definition: ews.hpp:13368
The item is master for a set of recurring calendar items.
time_t to_epoch() const
Definition: ews.hpp:12314
std::string get_mileage() const
Returns the mileage associated with the task.
Definition: ews.hpp:15188
void set_proxy(const std::string &url)
Sets the URL of the proxy which should be used for connecting to the EWS service. ...
Definition: ews.hpp:20830
std::vector< item_id > create_item(const std::vector< calendar_item > &calendar_items, send_meeting_invitations send_invitations, const folder_id &folder)
Creates new calendar items from the given vector in the specified folder.
Definition: ews.hpp:21438
static occurrence_info from_xml_element(const rapidxml::xml_node<> &elem)
Makes a occurrence_info instance from a <FirstOccurrence>, <LastOccurrence>, or <Occurrence> XML elem...
Definition: ews.hpp:17057
containment_mode
Specifies which parts of a text value are compared to a supplied constant value.
Definition: ews.hpp:20208
Represents a SMTP mailbox.
Definition: ews.hpp:9455
item_id create_item(const contact &the_contact)
Creates a new contact from the given object in the Exchange store.
Definition: ews.hpp:21345
void set_proposed_end(const date_time &end)
Sets the end date and time that was proposed by the attendee.
Definition: ews.hpp:12785
The time slot is potentially filled.
folder_id update_folder(folder_id folder_id, const std::vector< update > &changes)
Update multiple properties of an existing folder.
Definition: ews.hpp:21855
Something strange but not fatal happened.
void set_recurrence(const recurrence_pattern &pattern, const recurrence_range &range)
Sets the recurrence pattern for calendar items and meeting requests.
Definition: ews.hpp:18193
Indicates that no response is received.
const date_time & get_proposed_start() const EWS_NOEXCEPT
Returns the date and time that was proposed as the start by the attendee.
Definition: ews.hpp:12770
calendar_item get_calendar_item(const occurrence_item_id &id, const item_shape &shape=item_shape())
Gets a calendar item from the Exchange store.
Definition: ews.hpp:21109
void set_request_server_version(server_version vers)
Sets the schema version that will be used in requests made by this service.
Definition: ews.hpp:20803
The Local Failures folder.
std::vector< resolution >::iterator begin()
Range-based for loop support.
Definition: ews.hpp:9738
The calendar item is updated but updates are not sent to attendee.
bool none() const EWS_NOEXCEPT
Definition: ews.hpp:12705
This error occurs when an invalid SID is passed in a request.
unsigned long line_position() const EWS_NOEXCEPT
Column number in request string where the error was found.
Definition: ews.hpp:7698
const std::string & id() const EWS_NOEXCEPT
Returns the identifier.
Definition: ews.hpp:9207
status get_status() const
Returns the status of the task.
Definition: ews.hpp:15250
Can read, create, and modify items.
This error indicates that the user could not be found.
bool is_cancelled() const
Indicates whether this calendar item has been cancelled by the organizer.
Definition: ews.hpp:17956
std::string to_xml() const
Returns the XML serialized version of this attendee instance.
Definition: ews.hpp:12788
The item is moved to a dedicated "Trash" folder.
std::vector< item_id > create_item(const std::vector< task > &tasks)
Creates new tasks from the given vector in the Exchange store.
Definition: ews.hpp:21323
task get_task(const item_id &id, const item_shape &shape=item_shape())
Gets a task from the Exchange store.
Definition: ews.hpp:21067
size_t content_size() const
Returns the attachment's size in bytes.
Definition: ews.hpp:11012
message get_message(const item_id &id, const item_shape &shape=item_shape())
Gets a message item from the Exchange store.
Definition: ews.hpp:21159
Definition: ews.hpp:12188
void set_extended_property(const extended_property &extended_prop)
Sets an extended property of an item.
Definition: ews.hpp:14006
Represents an <ExtendedProperty>.
Definition: ews.hpp:13334
item_id(std::string id, std::string change_key)
Constructs an <ItemId> from given identifier and change key.
Definition: ews.hpp:9201
This error occurs if the restriction contains more than 255 nodes.
The response will return an item body as plain-text.
An update to a single property of an item.
Definition: ews.hpp:20456
importance get_importance() const
Returns the importance of this item.
Definition: ews.hpp:13801
void send_item(const item_id &id, const folder_id &folder)
Sends a message that is already in the Exchange store.
Definition: ews.hpp:21539
This error occurs if there is no Calendar folder for the mailbox.
The time slot is open for other events.
void set_total_work(int total_work)
Sets the total amount of work for this task.
Definition: ews.hpp:15306
time_zone get_time_zone()
Returns the time zone ID currently used for the header of the request made by this service...
Definition: ews.hpp:20814
message(item_id id)
Constructs a new message object with the given id.
Definition: ews.hpp:18517
static folder from_xml_element(const rapidxml::xml_node<> &elem)
Makes a message instance from a <Message> XML element.
Definition: ews.hpp:13499
Definition: ews.hpp:12129
Represents an item's <MimeContent CharacterSet="" /> element.
Definition: ews.hpp:12677
void set_from(const ews::mailbox &m)
Sets the From: header field of this message.
Definition: ews.hpp:18614
void send_item(const std::vector< item_id > &ids, const folder_id &folder)
Sends messages that are already in the Exchange store.
Definition: ews.hpp:21567
const item_id & get_item_id() const EWS_NOEXCEPT
Returns the id of an item.
Definition: ews.hpp:13570
The item is an exception to a recurring calendar item.
std::string get_when() const
Returns a description of when this calendar item occurs.
Definition: ews.hpp:17936
connecting_sid(type, const std::string &)
Constructs a new ConnectingSID element.
Definition: ews.hpp:20609
The task is started and in progress.
Can read and create items.
This error is intended for internal use only.
item_id create_item(const task &the_task)
Creates a new task from the given object in the Exchange store.
Definition: ews.hpp:21303
This error indicates that a user's dial plan is not available.
void set_reminder_enabled(bool enabled)
Set a reminder on this item.
Definition: ews.hpp:13923
void set_status(status s)
Sets the status of the task to s.
Definition: ews.hpp:15280
This class allows OAuth2 authentification using the Ressource Owner Password Credentials grant...
Definition: ews.hpp:8280
int get_unread_count() const
Returns the number of unread items in this folder.
Definition: ews.hpp:13493
The paged view starts at the end of the found conversation or item set.
std::function< void(const std::string &)> debug_callback
Callback for debug messages.
Definition: ews.hpp:20716
void set_sender(const ews::mailbox &m)
Sets the Sender: header field of this message.
Definition: ews.hpp:18538
void set_is_read(bool value)
Sets whether this message has been read.
Definition: ews.hpp:18660
This error indicates that a valid VoIP gateway is not available.
This class allows OAuth2 authentification using the client credentials grant type.
Definition: ews.hpp:8257
This error indicates that the specified delegate user ID is invalid.
occurrence_item_id(std::string id)
Constructs an <OccurrenceItemId> from given id string.
Definition: ews.hpp:9263
Represents the Server Failures folder.
date_time get_original_start() const
The original start time of a calendar item.
Definition: ews.hpp:17865
property(indexed_property_path path)
Definition: ews.hpp:19413
resolution_set resolve_names(const std::string &unresolved_entry, search_scope scope)
The ResolveNames operation resolves ambiguous email addresses and display names.
Definition: ews.hpp:22089
day_of_week_index
This element describes which week in a month is used in a relative recurrence pattern.
Definition: ews.hpp:14907
type get_type() const EWS_NOEXCEPT
Returns either type::file or type::item.
Definition: ews.hpp:11048
date_time get_appointment_reply_time() const
Returns the date and time when when this meeting was responded to.
Definition: ews.hpp:18138
bool is_from_me() const
True if this item is from you.
Definition: ews.hpp:13836
std::vector< message > get_messages(const std::vector< item_id > &ids, const item_shape &shape=item_shape())
Gets multiple message items from the Exchange store.
Definition: ews.hpp:21166
Indicates that the retention tag GUID was invalid.
void set_legacy_free_busy_status(free_busy_status status)
Sets the free/busy status of this calendar item.
Definition: ews.hpp:17915
The comparison is between an exact phrase in the string and the constant.
This error indicates that the caller identifier is not valid.
basic_service(const std::string &server_uri, const std::string &domain, const std::string &username, const std::string &password)
Constructs a new service with given credentials to a server specified by server_uri.
Definition: ews.hpp:20726
const std::string & character_set() const EWS_NOEXCEPT
Returns how the string is encoded, e.g., "UTF-8".
Definition: ews.hpp:12693
exchange_error(response_code code, const std::string &message_text)
Constructs an exchange_error from a <ResponseCode> and additional error message, e.g., from an <MessageText> element.
Definition: ews.hpp:7519
An event that occurs on the same day each month or monthly interval.
Definition: ews.hpp:17319
This response code is not used.
Send the message and do not save a copy in the sender's mailbox.
std::vector< extended_property > get_extended_properties() const
Definition: ews.hpp:13983
static mailbox from_xml_element(const rapidxml::xml_node<> &elem)
Makes a mailbox instance from a <Mailbox> XML element.
Definition: ews.hpp:9608
const extended_field_uri & get_extended_field_uri() const EWS_NOEXCEPT
Definition: ews.hpp:13361
The strings must exactly be the same.
property(property_path path)
Use this constructor if you want to delete a property from an item.
Definition: ews.hpp:19409
This error occurs when the folder ID is corrupt.
This response code is not used.
An event that occurs annually relative to a month, week, and day.
Definition: ews.hpp:17180
item_id delete_attachment(const attachment_id &id)
Deletes given attachment from the Exchange store.
Definition: ews.hpp:22062
const std::string & id() const EWS_NOEXCEPT
Returns a string identifying a folder in the Exchange store.
Definition: ews.hpp:9822
response_type
The ResponseType element represents the type of recipient response that is received for a meeting...
Definition: ews.hpp:6994
server_version get_request_server_version() const
Returns the schema version that is used in requests by this service.
Definition: ews.hpp:20944
Represents a single property.
Definition: ews.hpp:19403
Indicates that the source folder path could not be retrieved.
std::vector< attendee > get_resources() const
Returns all scheduled resources of this meeting.
Definition: ews.hpp:18067
unsigned long line_number() const EWS_NOEXCEPT
Line number in request string where the error was found.
Definition: ews.hpp:7695
void set_meeting_workspace_url(const std::string &url)
Sets the URL for a meeting workspace.
Definition: ews.hpp:18416
bool valid() const EWS_NOEXCEPT
Whether this folder_id is valid.
Definition: ews.hpp:9828
This error occurs when the specified recurrence cannot be created.
void set_reminder_minutes_before_start(uint32_t minutes)
Sets the minutes before due date that a reminder should be shown to the user.
Definition: ews.hpp:13936
This error occurs when an invalid time zone is encountered.
Definition: ews.hpp:15344
The root of the message folder hierarchy.
mailbox get_organizer() const
Returns the organizer of this calendar item.
Definition: ews.hpp:18032
static std::unique_ptr< recurrence_pattern > from_xml_element(const rapidxml::xml_node<> &elem)
Makes a recurrence_pattern instance from a <Recurrence> XML element.
Definition: ews.hpp:24543
std::string content_type() const
Returns the attachment's content type.
Definition: ews.hpp:10991
item_id update_item(item_id id, const std::vector< update > &changes, conflict_resolution resolution, send_meeting_invitations_or_cancellations invitations_or_cancellations, const folder_id &folder)
Update multiple properties of an existing item in the specified folder.
Definition: ews.hpp:21822
This response code is not used.
rapidxml::xml_node & to_xml_element(rapidxml::xml_node<> &parent) const
Creates a new <Attendee> XML element and appends it to given parent node.
Definition: ews.hpp:12815
This error occurs when the folder is corrupted and cannot be saved.
const folder_id & get_folder_id() const EWS_NOEXCEPT
Returns the id of a folder.
Definition: ews.hpp:13458
The ExtendedFieldURI element identifies an extended MAPI property.
Definition: ews.hpp:13009
static message from_xml_element(const rapidxml::xml_node<> &elem)
Makes a message instance from a <Message> XML element.
Definition: ews.hpp:18685
void set_required_attendees(const std::vector< attendee > &attendees) const
Sets the attendees required to attend this meeting.
Definition: ews.hpp:18049
The comparison is between the full string and the constant.
void set_online_meeting_enabled(bool enabled)
If set to true, this meeting is supposed to be held online.
Definition: ews.hpp:18400
delegation_state get_delegation_state() const
Returns the delegation state of this task.
Definition: ews.hpp:15095
void set_percent_complete(int value)
Sets the percentage of the task that has been completed.
Definition: ews.hpp:15229