示例#1
0
        /// <summary>
        /// Writes elements to XML.
        /// </summary>
        /// <param name="writer">The writer.</param>
        internal override void WriteElementsToXml(EwsServiceXmlWriter writer)
        {
            writer.WriteElementValue(XmlNamespace.Types, XmlElementNames.FlagStatus, this.FlagStatus);

            if (this.FlagStatus == ItemFlagStatus.Flagged)
            {
                writer.WriteElementValue(XmlNamespace.Types, XmlElementNames.StartDate, this.StartDate);
                writer.WriteElementValue(XmlNamespace.Types, XmlElementNames.DueDate, this.DueDate);
            }
            else if (this.FlagStatus == ItemFlagStatus.Complete)
            {
                writer.WriteElementValue(XmlNamespace.Types, XmlElementNames.CompleteDate, this.CompleteDate);
            }
        }
        /// <summary>
        /// Writes the elements to XML.
        /// </summary>
        /// <param name="writer">The writer.</param>
        internal override void WriteElementsToXml(EwsServiceXmlWriter writer)
        {
            writer.WriteStartElement(XmlNamespace.Types, XmlElementNames.Mailbox);
            writer.WriteElementValue(XmlNamespace.Types, XmlElementNames.Address, this.SmtpAddress);
            writer.WriteEndElement(); // Mailbox

            this.OofSettings.WriteToXml(writer, XmlElementNames.UserOofSettings);
        }
            /// <summary>
            /// Write properties to XML.
            /// </summary>
            /// <param name="writer">The writer.</param>
            internal override void InternalWritePropertiesToXml(EwsServiceXmlWriter writer)
            {
                base.InternalWritePropertiesToXml(writer);

                writer.WriteElementValue(
                    XmlNamespace.Types,
                    XmlElementNames.Interval,
                    this.Interval);
            }
            /// <summary>
            /// Write properties to XML.
            /// </summary>
            /// <param name="writer">The writer.</param>
            internal override void InternalWritePropertiesToXml(EwsServiceXmlWriter writer)
            {
                base.InternalWritePropertiesToXml(writer);

                writer.WriteElementValue(
                    XmlNamespace.Types,
                    XmlElementNames.DaysOfWeek,
                    this.DayOfTheWeek);

                writer.WriteElementValue(
                    XmlNamespace.Types,
                    XmlElementNames.DayOfWeekIndex,
                    this.DayOfTheWeekIndex);

                writer.WriteElementValue(
                    XmlNamespace.Types,
                    XmlElementNames.Month,
                    this.Month);
            }
 /// <summary>
 /// Writes XML elements.
 /// </summary>
 /// <param name="writer">The writer.</param>
 internal override void WriteElementsToXml(EwsServiceXmlWriter writer)
 {
     if (!string.IsNullOrEmpty(this.mailboxSmtpAddress))
     {
         writer.WriteElementValue(
             XmlNamespace.Messages,
             XmlElementNames.MailboxSmtpAddress,
             this.mailboxSmtpAddress);
     }
     
     writer.WriteElementValue(
         XmlNamespace.Messages,
         XmlElementNames.RemoveOutlookRuleBlob, 
         this.RemoveOutlookRuleBlob);
     writer.WriteStartElement(XmlNamespace.Messages, XmlElementNames.Operations);
     foreach (RuleOperation operation in this.inboxRuleOperations)
     {
         operation.WriteToXml(writer, operation.XmlElementName);
     }
     writer.WriteEndElement();
 }
        /// <summary>
        /// Writes XML elements.
        /// </summary>
        /// <param name="writer">The writer.</param>
        internal override void WriteElementsToXml(EwsServiceXmlWriter writer)
        {
            writer.WriteStartElement(XmlNamespace.Messages, XmlElementNames.Manifest);

            writer.WriteBase64ElementValue(manifestStream);

            writer.WriteEndElement();

            if (!string.IsNullOrEmpty(this.marketplaceAssetId))
            {
                writer.WriteElementValue(XmlNamespace.Messages, XmlElementNames.MarketplaceAssetId, this.marketplaceAssetId);

                if (!string.IsNullOrEmpty(this.marketplaceContentMarket))
                {
                    writer.WriteElementValue(XmlNamespace.Messages, XmlElementNames.MarketplaceContentMarket, this.marketplaceContentMarket);
                }

                writer.WriteElementValue(XmlNamespace.Messages, XmlElementNames.SendWelcomeEmail, this.sendWelcomeEmail);
            }

            writer.WriteEndElement();
        }
        /// <summary>
        /// Writes to XML.
        /// </summary>
        /// <param name="writer">The writer.</param>
        /// <param name="requestedServerVersion">The requested server version.</param>
        internal void WriteToXml(EwsServiceXmlWriter writer, ExchangeVersion requestedServerVersion)
        {
            if (string.IsNullOrEmpty(this.id))
            {
                throw new ArgumentException(Strings.IdPropertyMustBeSet);
            }

            writer.WriteStartElement(XmlNamespace.Types, XmlElementNames.OpenAsAdminOrSystemService);
            writer.WriteAttributeString(XmlElementNames.LogonType, this.logonType.ToString());
            if (requestedServerVersion >= ExchangeVersion.Exchange2013 && this.budgetType.HasValue)
            {
                writer.WriteAttributeString(XmlElementNames.BudgetType, ((int)this.budgetType.Value).ToString());
            }

            writer.WriteStartElement(XmlNamespace.Types, XmlElementNames.ConnectingSID);
            writer.WriteElementValue(XmlNamespace.Types, this.idType.ToString(), this.id);
            writer.WriteEndElement(); // ConnectingSID
            writer.WriteEndElement(); // OpenAsAdminOrSystemService
        }
        /// <summary>
        /// Writes to XML.
        /// </summary>
        /// <param name="writer">The writer.</param>
        internal void WriteToXml(EwsServiceXmlWriter writer)
        {
            if (string.IsNullOrEmpty(this.id))
            {
                throw new ArgumentException(Strings.IdPropertyMustBeSet);
            }

            writer.WriteStartElement(XmlNamespace.Types, XmlElementNames.ExchangeImpersonation);
            writer.WriteStartElement(XmlNamespace.Types, XmlElementNames.ConnectingSID);

            // For 2007 SP1, use PrimarySmtpAddress for type SmtpAddress
            string connectingIdTypeLocalName =
                (this.idType == ConnectingIdType.SmtpAddress) && (writer.Service.RequestedServerVersion == ExchangeVersion.Exchange2007_SP1) 
                    ? XmlElementNames.PrimarySmtpAddress 
                    : this.IdType.ToString();

            writer.WriteElementValue(
                XmlNamespace.Types,
                connectingIdTypeLocalName,
                this.id);

            writer.WriteEndElement(); // ConnectingSID
            writer.WriteEndElement(); // ExchangeImpersonation
        }
 /// <summary>
 /// Writes XML elements.
 /// </summary>
 /// <param name="writer">The writer.</param>
 internal override void WriteElementsToXml(EwsServiceXmlWriter writer)
 {
     writer.WriteElementValue(XmlNamespace.Messages, XmlElementNames.SearchId, this.SearchId ?? string.Empty);
     writer.WriteElementValue(XmlNamespace.Messages, XmlElementNames.ExpandGroupMembership, this.ExpandGroupMembership.ToString().ToLower());
     writer.WriteElementValue(XmlNamespace.Messages, XmlElementNames.InPlaceHoldConfigurationOnly, this.InPlaceHoldConfigurationOnly.ToString().ToLower());
 }
示例#10
0
        /// <summary>
        /// Writes to XML.
        /// </summary>
        /// <param name="writer">The writer.</param>
        internal void WriteToXml(EwsServiceXmlWriter writer)
        {
            writer.WriteStartElement(XmlNamespace.Types, XmlElementNames.MailboxData);

            writer.WriteStartElement(XmlNamespace.Types, XmlElementNames.Email);
            writer.WriteElementValue(XmlNamespace.Types, XmlElementNames.Address, this.SmtpAddress);
            writer.WriteEndElement(); // Email

            writer.WriteElementValue(
                XmlNamespace.Types,
                XmlElementNames.AttendeeType,
                this.attendeeType);

            writer.WriteElementValue(
                XmlNamespace.Types,
                XmlElementNames.ExcludeConflicts,
                this.excludeConflicts);

            writer.WriteEndElement(); // MailboxData
        }
        /// <summary>
        /// Writes the property set to XML.
        /// </summary>
        /// <param name="writer">The writer to write to.</param>
        /// <param name="serviceObjectType">The type of service object the property set is emitted for.</param>
        internal void WriteToXml(EwsServiceXmlWriter writer, ServiceObjectType serviceObjectType)
        {
            string shapeElementName = GetShapeName(serviceObjectType);

            writer.WriteStartElement(XmlNamespace.Messages, shapeElementName);

            writer.WriteElementValue(
                XmlNamespace.Types,
                XmlElementNames.BaseShape,
                defaultPropertySetMap.Member[this.BasePropertySet]);

            if (serviceObjectType == ServiceObjectType.Item)
            {
                if (this.RequestedBodyType.HasValue)
                {
                    writer.WriteElementValue(
                        XmlNamespace.Types,
                        XmlElementNames.BodyType,
                        this.RequestedBodyType.Value);
                }

                if (this.RequestedUniqueBodyType.HasValue)
                {
                    writer.WriteElementValue(
                        XmlNamespace.Types,
                        XmlElementNames.UniqueBodyType,
                        this.RequestedUniqueBodyType.Value);
                }

                if (this.RequestedNormalizedBodyType.HasValue)
                {
                    writer.WriteElementValue(
                        XmlNamespace.Types,
                        XmlElementNames.NormalizedBodyType,
                        this.RequestedNormalizedBodyType.Value);
                }

                if (this.FilterHtmlContent.HasValue)
                {
                    writer.WriteElementValue(
                        XmlNamespace.Types,
                        XmlElementNames.FilterHtmlContent,
                        this.FilterHtmlContent.Value);
                }

                if (this.ConvertHtmlCodePageToUTF8.HasValue &&
                    writer.Service.RequestedServerVersion >= ExchangeVersion.Exchange2010_SP1)
                {
                    writer.WriteElementValue(
                        XmlNamespace.Types,
                        XmlElementNames.ConvertHtmlCodePageToUTF8,
                        this.ConvertHtmlCodePageToUTF8.Value);
                }

                if (!string.IsNullOrEmpty(this.InlineImageUrlTemplate) &&
                    writer.Service.RequestedServerVersion >= ExchangeVersion.Exchange2013)
                {
                    writer.WriteElementValue(
                        XmlNamespace.Types,
                        XmlElementNames.InlineImageUrlTemplate,
                        this.InlineImageUrlTemplate);
                }

                if (this.BlockExternalImages.HasValue &&
                    writer.Service.RequestedServerVersion >= ExchangeVersion.Exchange2013)
                {
                    writer.WriteElementValue(
                        XmlNamespace.Types,
                        XmlElementNames.BlockExternalImages,
                        this.BlockExternalImages.Value);
                }

                if (this.AddBlankTargetToLinks.HasValue &&
                    writer.Service.RequestedServerVersion >= ExchangeVersion.Exchange2013)
                {
                    writer.WriteElementValue(
                        XmlNamespace.Types,
                        XmlElementNames.AddBlankTargetToLinks,
                        this.AddBlankTargetToLinks.Value);
                }

                if (this.MaximumBodySize.HasValue &&
                    writer.Service.RequestedServerVersion >= ExchangeVersion.Exchange2013)
                {
                    writer.WriteElementValue(
                        XmlNamespace.Types,
                        XmlElementNames.MaximumBodySize,
                        this.MaximumBodySize.Value);
                }
            }

            if (this.additionalProperties.Count > 0)
            {
                WriteAdditionalPropertiesToXml(writer, this.additionalProperties);
            }

            writer.WriteEndElement(); // Item/FolderShape
        }
        /// <summary>
        /// Writes XML elements.
        /// </summary>
        /// <param name="writer">The writer.</param>
        internal override void WriteElementsToXml(EwsServiceXmlWriter writer)
        {
            writer.WriteElementValue(XmlNamespace.Messages, XmlElementNames.ActionType, this.ActionType.ToString());
            writer.WriteElementValue(XmlNamespace.Messages, XmlElementNames.HoldId, this.HoldId);
            writer.WriteElementValue(XmlNamespace.Messages, XmlElementNames.Query, this.Query ?? string.Empty);
            if (this.Mailboxes != null && this.Mailboxes.Length > 0)
            {
                writer.WriteStartElement(XmlNamespace.Messages, XmlElementNames.Mailboxes);
                foreach (string mailbox in this.Mailboxes)
                {
                    writer.WriteElementValue(XmlNamespace.Types, XmlElementNames.String, mailbox);
                }

                writer.WriteEndElement();   // Mailboxes
            }

            // Language
            if (!string.IsNullOrEmpty(this.Language))
            {
                writer.WriteElementValue(XmlNamespace.Messages, XmlElementNames.Language, this.Language);
            }

            if (!string.IsNullOrEmpty(this.InPlaceHoldIdentity))
            {
                writer.WriteElementValue(XmlNamespace.Messages, XmlElementNames.InPlaceHoldIdentity, this.InPlaceHoldIdentity);
            }

            if (!string.IsNullOrEmpty(this.ItemHoldPeriod))
            {
                writer.WriteElementValue(XmlNamespace.Messages, XmlElementNames.ItemHoldPeriod, this.ItemHoldPeriod);
            }
        }
示例#13
0
        /// <summary>
        /// Writes to XML.
        /// </summary>
        /// <param name="writer">The writer.</param>
        /// <param name="xmlElementName">Name of the XML element.</param>
        internal void WriteToXml(EwsServiceXmlWriter writer, string xmlElementName)
        {
            writer.WriteStartElement(XmlNamespace.Types, xmlElementName);

            if (this.Culture != null)
            {
                writer.WriteAttributeValue(
                    "xml",
                    "lang",
                    this.Culture);
            }

            writer.WriteElementValue(
                XmlNamespace.Types,
                XmlElementNames.Message,
                this.Message);

            writer.WriteEndElement(); // xmlElementName
        }
示例#14
0
        /// <summary>
        /// Writes elements to XML.
        /// </summary>
        /// <param name="writer">The writer.</param>
        internal override void WriteElementsToXml(EwsServiceXmlWriter writer)
        {
            if (this.Offset.HasValue)
            {
                writer.WriteElementValue(
                    XmlNamespace.Types,
                    XmlElementNames.Offset,
                    EwsUtilities.TimeSpanToXSDuration(this.Offset.Value));
            }

            if (this.Recurrence != null)
            {
                this.Recurrence.WriteToXml(writer, XmlElementNames.RelativeYearlyRecurrence);
            }

            if (this.AbsoluteDate.HasValue)
            {
                writer.WriteElementValue(
                    XmlNamespace.Types,
                    XmlElementNames.AbsoluteDate,
                    EwsUtilities.DateTimeToXSDate(new DateTime(this.AbsoluteDate.Value.Ticks, DateTimeKind.Unspecified)));
            }

            if (this.Time != null)
            {
                writer.WriteElementValue(
                    XmlNamespace.Types,
                    XmlElementNames.Time,
                    this.Time.ToXSTime());
            }
        }
        /// <summary>
        /// Writes XML elements.
        /// </summary>
        /// <param name="writer">The writer.</param>
        internal override void WriteElementsToXml(EwsServiceXmlWriter writer)
        {
            writer.WriteStartElement(XmlNamespace.Messages, XmlElementNames.Mailboxes);
            foreach (string mailbox in this.Mailboxes)
            {
                writer.WriteElementValue(XmlNamespace.Types, XmlElementNames.LegacyDN, mailbox);
            }

            writer.WriteEndElement();

            writer.WriteElementValue(XmlNamespace.Messages, XmlElementNames.SearchArchiveOnly, this.SearchArchiveOnly);
        }
 /// <summary>
 /// Writes XML elements.
 /// </summary>
 /// <param name="writer">The writer.</param>
 internal override void WriteElementsToXml(EwsServiceXmlWriter writer)
 {
     writer.WriteElementValue(XmlNamespace.Messages, XmlElementNames.OMEConfigurationXml, this.Xml);
 }
示例#17
0
 /// <summary>
 /// Writes XML elements.
 /// </summary>
 /// <param name="writer">The writer.</param>
 internal override void WriteElementsToXml(EwsServiceXmlWriter writer)
 {
     writer.WriteElementValue(XmlNamespace.Messages, XmlElementNames.MailboxSmtpAddress, this.MailboxSmtpAddress);
 }
 /// <summary>
 /// Writes XML elements.
 /// </summary>
 /// <param name="writer">The writer.</param>
 internal override void WriteElementsToXml(EwsServiceXmlWriter writer)
 {
     writer.WriteElementValue(XmlNamespace.Messages, XmlElementNames.SearchFilter, this.SearchFilter ?? string.Empty);
     writer.WriteElementValue(XmlNamespace.Messages, XmlElementNames.ExpandGroupMembership, this.ExpandGroupMembership.ToString().ToLower());
 }
示例#19
0
 /// <summary>
 /// Writes XML elements.
 /// </summary>
 /// <param name="writer">The writer.</param>
 internal override void WriteElementsToXml(EwsServiceXmlWriter writer)
 {
     writer.WriteElementValue(XmlNamespace.Messages, XmlElementNames.ID, this.ID);
 }
 /// <summary>
 /// Writes XML elements.
 /// </summary>
 /// <param name="writer">The writer.</param>
 internal override void WriteElementsToXml(EwsServiceXmlWriter writer)
 {
     this.itemId.WriteToXml(writer, XmlNamespace.Messages, XmlElementNames.ItemId);
     writer.WriteElementValue(XmlNamespace.Messages, XmlElementNames.DialString, dialString);
 }
        /// <summary>
        /// Writes the elements to XML.
        /// </summary>
        /// <param name="writer">The writer.</param>
        internal override void WriteElementsToXml(EwsServiceXmlWriter writer)
        {
            writer.WriteElementValue(
                XmlNamespace.Types,
                XmlElementNames.Bias,
                (int)this.bias.TotalMinutes);

            this.standardTime.WriteToXml(writer, XmlElementNames.StandardTime);
            this.daylightTime.WriteToXml(writer, XmlElementNames.DaylightTime);
        }
        /// <summary>
        /// Writes XML elements.
        /// </summary>
        /// <param name="writer">The writer.</param>
        internal override void WriteElementsToXml(EwsServiceXmlWriter writer)
        {
            if (null != this.requestedExtensionIds && this.requestedExtensionIds.Count > 0)
            {
                writer.WriteStartElement(XmlNamespace.Messages, XmlElementNames.ClientExtensionRequestedIds);
                requestedExtensionIds.WriteElementsToXml(writer);
                writer.WriteEndElement();
            }
            
            if (this.isUserScope)
            {
                writer.WriteStartElement(XmlNamespace.Messages, XmlElementNames.ClientExtensionUserRequest);

                writer.WriteAttributeValue(XmlAttributeNames.ClientExtensionUserIdentity, this.userId);

                if (shouldReturnEnabledOnly)
                {
                    writer.WriteAttributeValue(XmlAttributeNames.ClientExtensionEnabledOnly, this.shouldReturnEnabledOnly);
                }

                if (null != this.userEnabledExtensionIds && this.userEnabledExtensionIds.Count > 0)
                {
                    writer.WriteStartElement(XmlNamespace.Types, XmlElementNames.ClientExtensionUserEnabled);
                    userEnabledExtensionIds.WriteElementsToXml(writer);
                    writer.WriteEndElement();
                }

                if (null != this.userDisabledExtensionIds && this.userDisabledExtensionIds.Count > 0)
                {
                    writer.WriteStartElement(XmlNamespace.Types, XmlElementNames.ClientExtensionUserDisabled);
                    userDisabledExtensionIds.WriteElementsToXml(writer);
                    writer.WriteEndElement();
                }

                writer.WriteEndElement();
            }

            if (isDebug)
            {
                writer.WriteElementValue(XmlNamespace.Messages, XmlElementNames.ClientExtensionIsDebug, isDebug);
            }
        }
            /// <summary>
            /// Write properties to XML.
            /// </summary>
            /// <param name="writer">The writer.</param>
            internal override void InternalWritePropertiesToXml(EwsServiceXmlWriter writer)
            {
                base.InternalWritePropertiesToXml(writer);

                this.DaysOfTheWeek.WriteToXml(writer, XmlElementNames.DaysOfWeek);

                if (this.firstDayOfWeek.HasValue)
                {
                    //  We only allow the "FirstDayOfWeek" parameter for the Exchange2010_SP1 schema
                    //  version.
                    //
                    EwsUtilities.ValidatePropertyVersion(
                        (ExchangeService) writer.Service,
                        ExchangeVersion.Exchange2010_SP1,
                        "FirstDayOfWeek");
                    
                    writer.WriteElementValue(
                        XmlNamespace.Types,
                        XmlElementNames.FirstDayOfWeek,
                        this.firstDayOfWeek.Value);
                }
            }
 /// <summary>
 /// Writes XML elements.
 /// </summary>
 /// <param name="writer">The writer.</param>
 internal override void WriteElementsToXml(EwsServiceXmlWriter writer)
 {
     this.emailAddress.WriteToXml(writer, XmlNamespace.Messages, XmlElementNames.EmailAddress);
     writer.WriteElementValue(XmlNamespace.Messages, XmlElementNames.SharePointSiteUrl, this.sharePointSiteUrl.ToString());
     writer.WriteElementValue(XmlNamespace.Messages, XmlElementNames.State, this.state.ToString());
 }
        /// <summary>
        /// Writes XML elements.
        /// </summary>
        /// <param name="writer">The writer.</param>
        internal override void WriteElementsToXml(EwsServiceXmlWriter writer)
        {
            // Emit the view element
            //
            this.View.WriteToXml(writer, null);

            // Emit the Sort Order
            //
            this.View.WriteOrderByToXml(writer);

            // Emit the Parent Folder Id
            //
            writer.WriteStartElement(XmlNamespace.Messages, XmlElementNames.ParentFolderId);
            this.FolderId.WriteToXml(writer);
            writer.WriteEndElement();

            // Emit the MailboxScope flag
            // 
            if (this.MailboxScope.HasValue)
            {
                writer.WriteElementValue(XmlNamespace.Messages, XmlElementNames.MailboxScope, this.MailboxScope.Value);
            }

            if (!string.IsNullOrEmpty(this.queryString))
            {
                // Emit the QueryString
                //
                writer.WriteStartElement(XmlNamespace.Messages, XmlElementNames.QueryString);

                if (this.ReturnHighlightTerms)
                {
                    writer.WriteAttributeString(XmlAttributeNames.ReturnHighlightTerms, this.ReturnHighlightTerms.ToString().ToLowerInvariant());
                }

                writer.WriteValue(this.queryString, XmlElementNames.QueryString);
                writer.WriteEndElement();
            }

            if (this.Service.RequestedServerVersion >= ExchangeVersion.Exchange2013)
            {
                if (this.View.PropertySet != null)
                {
                    this.View.PropertySet.WriteToXml(writer, ServiceObjectType.Conversation);
                }
            }
        }
 /// <summary>
 /// Writes XML elements.
 /// </summary>
 /// <param name="writer">The writer.</param>
 internal override void WriteElementsToXml(EwsServiceXmlWriter writer)
 {
     this.itemId.WriteToXml(writer, XmlNamespace.Messages, XmlElementNames.ItemId);
     writer.WriteElementValue(XmlNamespace.Messages, XmlElementNames.DialString, dialString);
 }
示例#27
0
        /// <summary>
        /// Writes XML.
        /// </summary>
        /// <param name="writer">The writer.</param>
        internal void WriteToXml(EwsServiceXmlWriter writer)
        {
            writer.WriteStartElement(XmlNamespace.Soap, XmlElementNames.SOAPEnvelopeElementName);
            writer.WriteAttributeValue("xmlns", EwsUtilities.EwsXmlSchemaInstanceNamespacePrefix, EwsUtilities.EwsXmlSchemaInstanceNamespace);
            writer.WriteAttributeValue("xmlns", EwsUtilities.EwsMessagesNamespacePrefix, EwsUtilities.EwsMessagesNamespace);
            writer.WriteAttributeValue("xmlns", EwsUtilities.EwsTypesNamespacePrefix, EwsUtilities.EwsTypesNamespace);
            if (writer.RequireWSSecurityUtilityNamespace)
            {
                writer.WriteAttributeValue("xmlns", EwsUtilities.WSSecurityUtilityNamespacePrefix, EwsUtilities.WSSecurityUtilityNamespace);
            }

            writer.WriteStartElement(XmlNamespace.Soap, XmlElementNames.SOAPHeaderElementName);

            if (this.Service.Credentials != null)
            {
                this.Service.Credentials.EmitExtraSoapHeaderNamespaceAliases(writer.InternalWriter);
            }

            // Emit the RequestServerVersion header
            if (!this.Service.SuppressXmlVersionHeader)
            {
                writer.WriteStartElement(XmlNamespace.Types, XmlElementNames.RequestServerVersion);
                writer.WriteAttributeValue(XmlAttributeNames.Version, this.GetRequestedServiceVersionString());
                writer.WriteEndElement(); // RequestServerVersion
            }

            // Against Exchange 2007 SP1, we always emit the simplified time zone header. It adds very little to
            // the request, so bandwidth consumption is not an issue. Against Exchange 2010 and above, we emit
            // the full time zone header but only when the request actually needs it.
            //
            // The exception to this is if we are in Exchange2007 Compat Mode, in which case we should never emit
            // the header.  (Note: Exchange2007 Compat Mode is enabled for testability purposes only.)
            //
            if ((this.Service.RequestedServerVersion == ExchangeVersion.Exchange2007_SP1 || this.EmitTimeZoneHeader) &&
                (!this.Service.Exchange2007CompatibilityMode))
            {
                writer.WriteStartElement(XmlNamespace.Types, XmlElementNames.TimeZoneContext);

                this.Service.TimeZoneDefinition.WriteToXml(writer);

                writer.WriteEndElement(); // TimeZoneContext

                writer.IsTimeZoneHeaderEmitted = true;
            }

            // Emit the MailboxCulture header
            if (this.Service.PreferredCulture != null)
            {
                writer.WriteElementValue(
                    XmlNamespace.Types,
                    XmlElementNames.MailboxCulture,
                    this.Service.PreferredCulture.Name);
            }

            // Emit the DateTimePrecision header
            if (this.Service.DateTimePrecision != DateTimePrecision.Default)
            {
                writer.WriteElementValue(
                    XmlNamespace.Types,
                    XmlElementNames.DateTimePrecision,
                    this.Service.DateTimePrecision.ToString());
            }

            // Emit the ExchangeImpersonation header
            if (this.Service.ImpersonatedUserId != null)
            {
                this.Service.ImpersonatedUserId.WriteToXml(writer);
            }
            else if (this.Service.PrivilegedUserId != null)
            {
                this.Service.PrivilegedUserId.WriteToXml(writer, this.Service.RequestedServerVersion);
            }
            else if (this.Service.ManagementRoles != null)
            {
                this.Service.ManagementRoles.WriteToXml(writer);
            }

            if (this.Service.Credentials != null)
            {
                this.Service.Credentials.SerializeExtraSoapHeaders(writer.InternalWriter, this.GetXmlElementName());
            }

            this.Service.DoOnSerializeCustomSoapHeaders(writer.InternalWriter);

            writer.WriteEndElement(); // soap:Header

            writer.WriteStartElement(XmlNamespace.Soap, XmlElementNames.SOAPBodyElementName);

            this.WriteBodyToXml(writer);

            writer.WriteEndElement(); // soap:Body
            writer.WriteEndElement(); // soap:Envelope
        }
        /// <summary>
        /// Writes elements to XML.
        /// </summary>
        /// <param name="writer">The writer.</param>
        internal override void WriteElementsToXml(EwsServiceXmlWriter writer)
        {
            this.UserId.WriteToXml(writer, XmlElementNames.UserId);
            this.Permissions.WriteToXml(writer, XmlElementNames.DelegatePermissions);

            writer.WriteElementValue(
                XmlNamespace.Types,
                XmlElementNames.ReceiveCopiesOfMeetingMessages,
                this.ReceiveCopiesOfMeetingMessages);
        
            writer.WriteElementValue(
                XmlNamespace.Types,
                XmlElementNames.ViewPrivateItems,
                this.ViewPrivateItems);
        }
 /// <summary>
 /// Writes elements to XML.
 /// </summary>
 /// <param name="writer">The writer.</param>
 internal override void WriteElementsToXml(EwsServiceXmlWriter writer)
 {
     writer.WriteElementValue(
         XmlNamespace.Types,
         XmlElementNames.StartDate,
         EwsUtilities.DateTimeToXSDate(this.StartDate));
 }
        /// <summary>
        /// WriteRolesToXml
        /// </summary>
        /// <param name="writer"></param>
        /// <param name="roles"></param>
        /// <param name="elementName"></param>
        private void WriteRolesToXml(EwsServiceXmlWriter writer, string[] roles, string elementName)
        {
            if (roles != null)
            {
                writer.WriteStartElement(XmlNamespace.Types, elementName);

                foreach (string role in roles)
                {
                    writer.WriteElementValue(XmlNamespace.Types, XmlElementNames.Role, role);
                }

                writer.WriteEndElement();
            }
        }
        /// <summary>
        /// Writes request to XML.
        /// </summary>
        /// <param name="writer">The writer.</param>
        internal override void WriteElementsToXml(EwsServiceXmlWriter writer)
        {
            writer.WriteStartElement(XmlNamespace.Autodiscover, XmlElementNames.Request);

            writer.WriteStartElement(XmlNamespace.Autodiscover, XmlElementNames.Domains);

            foreach (string domain in this.Domains)
            {
                if (!string.IsNullOrEmpty(domain))
                {
                    writer.WriteElementValue(
                        XmlNamespace.Autodiscover,
                        XmlElementNames.Domain,
                        domain);
                }
            }
            writer.WriteEndElement(); // Domains

            writer.WriteStartElement(XmlNamespace.Autodiscover, XmlElementNames.RequestedSettings);
            foreach (DomainSettingName setting in settings)
            {
                writer.WriteElementValue(
                    XmlNamespace.Autodiscover,
                    XmlElementNames.Setting,
                    setting);
            }

            writer.WriteEndElement(); // RequestedSettings

            if (this.requestedVersion.HasValue)
            {
                writer.WriteElementValue(XmlNamespace.Autodiscover, XmlElementNames.RequestedVersion, this.requestedVersion.Value);
            }

            writer.WriteEndElement(); // Request
        }
        /// <summary>
        /// Writes elements to XML.
        /// </summary>
        /// <param name="writer">The writer.</param>
        internal override void WriteElementsToXml(EwsServiceXmlWriter writer)
        {
            if (this.AssignCategories.Count > 0)
            {
                this.AssignCategories.WriteToXml(writer, XmlElementNames.AssignCategories);
            }

            if (this.CopyToFolder != null)
            {
                writer.WriteStartElement(XmlNamespace.Types, XmlElementNames.CopyToFolder);
                this.CopyToFolder.WriteToXml(writer);
                writer.WriteEndElement();
            }

            if (this.Delete != false)
            {
                writer.WriteElementValue(
                    XmlNamespace.Types, 
                    XmlElementNames.Delete, 
                    this.Delete);
            }

            if (this.ForwardAsAttachmentToRecipients.Count > 0)
            {
                this.ForwardAsAttachmentToRecipients.WriteToXml(writer, XmlElementNames.ForwardAsAttachmentToRecipients);
            }

            if (this.ForwardToRecipients.Count > 0)
            {
                this.ForwardToRecipients.WriteToXml(writer, XmlElementNames.ForwardToRecipients);
            }

            if (this.MarkImportance.HasValue)
            {
                writer.WriteElementValue(
                    XmlNamespace.Types, 
                    XmlElementNames.MarkImportance, 
                    this.MarkImportance.Value);
            }

            if (this.MarkAsRead != false)
            {
                writer.WriteElementValue(
                    XmlNamespace.Types,
                    XmlElementNames.MarkAsRead,
                    this.MarkAsRead);
            }

            if (this.MoveToFolder != null)
            {
                writer.WriteStartElement(XmlNamespace.Types, XmlElementNames.MoveToFolder);
                this.MoveToFolder.WriteToXml(writer);
                writer.WriteEndElement();
            }

            if (this.PermanentDelete != false)
            {
                writer.WriteElementValue(
                    XmlNamespace.Types, 
                    XmlElementNames.PermanentDelete, 
                    this.PermanentDelete);
            }

            if (this.RedirectToRecipients.Count > 0)
            {
                this.RedirectToRecipients.WriteToXml(writer, XmlElementNames.RedirectToRecipients);
            }

            if (this.SendSMSAlertToRecipients.Count > 0)
            {
                EmailAddressCollection emailCollection = ConvertSMSRecipientsFromMobilePhoneCollectionToEmailAddressCollection(this.SendSMSAlertToRecipients);
                emailCollection.WriteToXml(writer, XmlElementNames.SendSMSAlertToRecipients);
            }

            if (this.ServerReplyWithMessage != null)
            {
                this.ServerReplyWithMessage.WriteToXml(writer, XmlElementNames.ServerReplyWithMessage);
            }

            if (this.StopProcessingRules != false)
            {
                writer.WriteElementValue(
                    XmlNamespace.Types, 
                    XmlElementNames.StopProcessingRules, 
                    this.StopProcessingRules);
            }
        }
示例#33
0
        /// <summary>
        /// Writes XML elements.
        /// </summary>
        /// <param name="writer">The writer.</param>
        internal override void WriteElementsToXml(EwsServiceXmlWriter writer)
        {
            writer.WriteStartElement(XmlNamespace.Messages, XmlElementNames.SearchQueries);
            foreach (MailboxQuery mailboxQuery in this.SearchQueries)
            {
                writer.WriteStartElement(XmlNamespace.Types, XmlElementNames.MailboxQuery);
                writer.WriteElementValue(XmlNamespace.Types, XmlElementNames.Query, mailboxQuery.Query);
                writer.WriteStartElement(XmlNamespace.Types, XmlElementNames.MailboxSearchScopes);
                foreach (MailboxSearchScope mailboxSearchScope in mailboxQuery.MailboxSearchScopes)
                {
                    // The checks here silently downgrade the schema based on compatibility checks, to receive errors use the validate method
                    if (mailboxSearchScope.SearchScopeType == MailboxSearchScopeType.LegacyExchangeDN || DiscoverySchemaChanges.SearchMailboxesAdditionalSearchScopes.IsCompatible(this))
                    {
                        writer.WriteStartElement(XmlNamespace.Types, XmlElementNames.MailboxSearchScope);
                        writer.WriteElementValue(XmlNamespace.Types, XmlElementNames.Mailbox, mailboxSearchScope.Mailbox);
                        writer.WriteElementValue(XmlNamespace.Types, XmlElementNames.SearchScope, mailboxSearchScope.SearchScope);

                        if (DiscoverySchemaChanges.SearchMailboxesExtendedData.IsCompatible(this))
                        {
                            writer.WriteStartElement(XmlNamespace.Types, XmlElementNames.ExtendedAttributes);

                            if (mailboxSearchScope.SearchScopeType != MailboxSearchScopeType.LegacyExchangeDN)
                            {
                                writer.WriteStartElement(XmlNamespace.Types, XmlElementNames.ExtendedAttribute);
                                writer.WriteElementValue(XmlNamespace.Types, XmlElementNames.ExtendedAttributeName, XmlElementNames.SearchScopeType);
                                writer.WriteElementValue(XmlNamespace.Types, XmlElementNames.ExtendedAttributeValue, mailboxSearchScope.SearchScopeType);
                                writer.WriteEndElement();
                            }

                            if (mailboxSearchScope.ExtendedAttributes != null && mailboxSearchScope.ExtendedAttributes.Count > 0)
                            {
                                foreach (ExtendedAttribute attribute in mailboxSearchScope.ExtendedAttributes)
                                {
                                    writer.WriteStartElement(XmlNamespace.Types, XmlElementNames.ExtendedAttribute);
                                    writer.WriteElementValue(XmlNamespace.Types, XmlElementNames.ExtendedAttributeName, attribute.Name);
                                    writer.WriteElementValue(XmlNamespace.Types, XmlElementNames.ExtendedAttributeValue, attribute.Value);
                                    writer.WriteEndElement();
                                }
                            }

                            writer.WriteEndElement();  // ExtendedData
                        }

                        writer.WriteEndElement();   // MailboxSearchScope
                    }
                }

                writer.WriteEndElement();   // MailboxSearchScopes
                writer.WriteEndElement();   // MailboxQuery
            }

            writer.WriteEndElement();   // SearchQueries
            writer.WriteElementValue(XmlNamespace.Messages, XmlElementNames.ResultType, this.ResultType);

            if (this.PreviewItemResponseShape != null)
            {
                writer.WriteStartElement(XmlNamespace.Messages, XmlElementNames.PreviewItemResponseShape);
                writer.WriteElementValue(XmlNamespace.Types, XmlElementNames.BaseShape, this.PreviewItemResponseShape.BaseShape);
                if (this.PreviewItemResponseShape.AdditionalProperties != null && this.PreviewItemResponseShape.AdditionalProperties.Length > 0)
                {
                    writer.WriteStartElement(XmlNamespace.Types, XmlElementNames.AdditionalProperties);
                    foreach (ExtendedPropertyDefinition additionalProperty in this.PreviewItemResponseShape.AdditionalProperties)
                    {
                        additionalProperty.WriteToXml(writer);
                    }

                    writer.WriteEndElement();   // AdditionalProperties
                }

                writer.WriteEndElement();   // PreviewItemResponseShape
            }

            if (!string.IsNullOrEmpty(this.SortByProperty))
            {
                writer.WriteStartElement(XmlNamespace.Messages, XmlElementNames.SortBy);
                writer.WriteAttributeValue(XmlElementNames.Order, this.SortOrder.ToString());
                writer.WriteStartElement(XmlNamespace.Types, XmlElementNames.FieldURI);
                writer.WriteAttributeValue(XmlElementNames.FieldURI, this.sortByProperty);
                writer.WriteEndElement();   // FieldURI
                writer.WriteEndElement();   // SortBy
            }

            // Language
            if (!string.IsNullOrEmpty(this.Language))
            {
                writer.WriteElementValue(XmlNamespace.Messages, XmlElementNames.Language, this.Language);
            }

            // Dedupe
            writer.WriteElementValue(XmlNamespace.Messages, XmlElementNames.Deduplication, this.performDeduplication);

            if (this.PageSize > 0)
            {
                writer.WriteElementValue(XmlNamespace.Messages, XmlElementNames.PageSize, this.PageSize.ToString());
            }

            if (!string.IsNullOrEmpty(this.PageItemReference))
            {
                writer.WriteElementValue(XmlNamespace.Messages, XmlElementNames.PageItemReference, this.PageItemReference);
            }

            writer.WriteElementValue(XmlNamespace.Messages, XmlElementNames.PageDirection, this.PageDirection.ToString());
        }
        /// <summary>
        /// Write permission to Xml.
        /// </summary>
        /// <param name="writer">The writer.</param>
        /// <param name="xmlElementName">The element name.</param>
        private void WritePermissionToXml(
            EwsServiceXmlWriter writer, 
            string xmlElementName)
        {
            DelegateFolderPermissionLevel delegateFolderPermissionLevel = this.delegateFolderPermissions[xmlElementName].PermissionLevel;

            // UpdateDelegate fails if Custom permission level is round tripped
            //
            if (delegateFolderPermissionLevel != DelegateFolderPermissionLevel.Custom)
            {
                writer.WriteElementValue(
                    XmlNamespace.Types,
                    xmlElementName,
                    delegateFolderPermissionLevel);
            }
        }
 /// <summary>
 /// Writes XML elements.
 /// </summary>
 /// <param name="writer">The writer.</param>
 internal override void WriteElementsToXml(EwsServiceXmlWriter writer)
 {
     writer.WriteStartElement(XmlNamespace.Types, XmlElementNames.Mailbox);
     writer.WriteElementValue(XmlNamespace.Types, XmlElementNames.Address, this.SmtpAddress);
     writer.WriteEndElement(); // Mailbox
 }
示例#36
0
        /// <summary>
        /// Writes elements to XML.
        /// </summary>
        /// <param name="writer">The writer.</param>
        internal override void WriteElementsToXml(EwsServiceXmlWriter writer)
        {
            writer.WriteElementValue(
                XmlNamespace.Types,
                XmlElementNames.SID,
                this.SID);

            writer.WriteElementValue(
                XmlNamespace.Types,
                XmlElementNames.PrimarySmtpAddress,
                this.PrimarySmtpAddress);

            writer.WriteElementValue(
                XmlNamespace.Types,
                XmlElementNames.DisplayName,
                this.DisplayName);

            writer.WriteElementValue(
                XmlNamespace.Types,
                XmlElementNames.DistinguishedUser,
                this.StandardUser);
        }
        /// <summary>
        /// Writes elements and content to XML.
        /// </summary>
        /// <param name="writer">The writer.</param>
        internal override void WriteElementsToXml(EwsServiceXmlWriter writer)
        {
            base.WriteElementsToXml(writer);

            if (writer.Service.RequestedServerVersion > ExchangeVersion.Exchange2007_SP1)
            {
                writer.WriteElementValue(XmlNamespace.Types, XmlElementNames.IsContactPhoto, this.isContactPhoto);
            }

            writer.WriteStartElement(XmlNamespace.Types, XmlElementNames.Content);

            if (!string.IsNullOrEmpty(this.FileName))
            {
                using (FileStream fileStream = new FileStream(this.FileName, FileMode.Open, FileAccess.Read))
                {
                    writer.WriteBase64ElementValue(fileStream);
                }
            }
            else if (this.ContentStream != null)
            {
                writer.WriteBase64ElementValue(this.ContentStream);
            }
            else if (this.Content != null)
            {
                writer.WriteBase64ElementValue(this.Content);
            }
            else
            {
                EwsUtilities.Assert(
                    false,
                    "FileAttachment.WriteElementsToXml",
                    "The attachment's content is not set.");
            }

            writer.WriteEndElement();
        }
 /// <summary>
 /// Writes elements to XML.
 /// </summary>
 /// <param name="writer">The writer.</param>
 internal override void WriteElementsToXml(EwsServiceXmlWriter writer)
 {
     if (this.Start.HasValue)
     {
         writer.WriteElementValue(XmlNamespace.Types, XmlElementNames.StartDateTime, this.Start.Value);
     }
     if (this.End.HasValue)
     {
         writer.WriteElementValue(XmlNamespace.Types, XmlElementNames.EndDateTime, this.End.Value);
     }
 }
        /// <summary>
        /// Writes to XML.
        /// </summary>
        /// <param name="writer">The writer.</param>
        /// <param name="request">The request being emitted.</param>
        internal void WriteToXml(EwsServiceXmlWriter writer, GetUserAvailabilityRequest request)
        {
            if (request.IsFreeBusyViewRequested)
            {
                writer.WriteStartElement(XmlNamespace.Types, XmlElementNames.FreeBusyViewOptions);

                request.TimeWindow.WriteToXmlUnscopedDatesOnly(writer, XmlElementNames.TimeWindow);

                writer.WriteElementValue(
                    XmlNamespace.Types,
                    XmlElementNames.MergedFreeBusyIntervalInMinutes,
                    this.MergedFreeBusyInterval);

                writer.WriteElementValue(
                    XmlNamespace.Types,
                    XmlElementNames.RequestedView,
                    this.RequestedFreeBusyView);

                writer.WriteEndElement(); // FreeBusyViewOptions
            }

            if (request.IsSuggestionsViewRequested)
            {
                writer.WriteStartElement(XmlNamespace.Types, XmlElementNames.SuggestionsViewOptions);

                writer.WriteElementValue(
                    XmlNamespace.Types,
                    XmlElementNames.GoodThreshold,
                    this.GoodSuggestionThreshold);

                writer.WriteElementValue(
                    XmlNamespace.Types,
                    XmlElementNames.MaximumResultsByDay,
                    this.MaximumSuggestionsPerDay);

                writer.WriteElementValue(
                    XmlNamespace.Types,
                    XmlElementNames.MaximumNonWorkHourResultsByDay,
                    this.MaximumNonWorkHoursSuggestionsPerDay);

                writer.WriteElementValue(
                    XmlNamespace.Types,
                    XmlElementNames.MeetingDurationInMinutes,
                    this.MeetingDuration);

                writer.WriteElementValue(
                    XmlNamespace.Types,
                    XmlElementNames.MinimumSuggestionQuality,
                    this.MinimumSuggestionQuality);

                TimeWindow timeWindowToSerialize = this.DetailedSuggestionsWindow == null ?
                    request.TimeWindow :
                    this.DetailedSuggestionsWindow;

                timeWindowToSerialize.WriteToXmlUnscopedDatesOnly(writer, XmlElementNames.DetailedSuggestionsWindow);

                if (this.CurrentMeetingTime.HasValue)
                {
                    writer.WriteElementValue(
                        XmlNamespace.Types,
                        XmlElementNames.CurrentMeetingTime,
                        this.CurrentMeetingTime.Value);
                }

                writer.WriteElementValue(
                    XmlNamespace.Types,
                    XmlElementNames.GlobalObjectId,
                    this.GlobalObjectId);

                writer.WriteEndElement(); // SuggestionsViewOptions
            }
        }
        /// <summary>
        /// Writes elements to XML.
        /// </summary>
        /// <param name="writer">The writer.</param>
        internal override void WriteElementsToXml(EwsServiceXmlWriter writer)
        {
            base.WriteElementsToXml(writer);

            writer.WriteElementValue(
                XmlNamespace.Types,
                XmlElementNames.DateTime,
                this.dateTime);
        }
 /// <summary>
 /// Writes elements to XML.
 /// </summary>
 /// <param name="writer">The writer.</param>
 internal override void WriteElementsToXml(EwsServiceXmlWriter writer)
 {
     writer.WriteElementValue(XmlNamespace.Types, XmlElementNames.LocationDisplayName, this.displayName);
     writer.WriteElementValue(XmlNamespace.Types, XmlElementNames.LocationAnnotation, this.annotation);
     this.personaPostalAddress.WriteToXml(writer);
 }