Ejemplo n.º 1
0
 /// <summary>
 /// Tries to read element from XML.
 /// </summary>
 /// <param name="reader">The reader.</param>
 /// <returns>True if appropriate element was read.</returns>
 internal override bool TryReadElementFromXml(EwsServiceXmlReader reader)
 {
     switch (reader.LocalName)
     {
         case XmlElementNames.OofState:
             this.state = reader.ReadValue<OofState>();
             return true;
         case XmlElementNames.ExternalAudience:
             this.externalAudience = reader.ReadValue<OofExternalAudience>();
             return true;
         case XmlElementNames.Duration:
             this.duration = new TimeWindow();
             this.duration.LoadFromXml(reader);
             return true;
         case XmlElementNames.InternalReply:
             this.internalReply = new OofReply();
             this.internalReply.LoadFromXml(reader, reader.LocalName);
             return true;
         case XmlElementNames.ExternalReply:
             this.externalReply = new OofReply();
             this.externalReply.LoadFromXml(reader, reader.LocalName);
             return true;
         default:
             return false;
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Loads from json.
        /// </summary>
        /// <param name="jsonProperty">The json property.</param>
        /// <param name="service"></param>
        internal override void LoadFromJson(JsonObject jsonProperty, ExchangeService service)
        {
            foreach (string key in jsonProperty.Keys)
            {
                switch (key)
                {
                case XmlElementNames.OofState:
                    this.state = jsonProperty.ReadEnumValue <OofState>(key);
                    break;

                case XmlElementNames.ExternalAudience:
                    this.externalAudience = jsonProperty.ReadEnumValue <OofExternalAudience>(key);
                    break;

                case XmlElementNames.Duration:
                    this.duration = new TimeWindow();
                    this.duration.LoadFromJson(jsonProperty.ReadAsJsonObject(key), service);
                    break;

                case XmlElementNames.InternalReply:
                    this.internalReply = new OofReply();
                    this.internalReply.LoadFromJson(jsonProperty.ReadAsJsonObject(key), service);
                    break;

                case XmlElementNames.ExternalReply:
                    this.externalReply = new OofReply();
                    this.externalReply.LoadFromJson(jsonProperty.ReadAsJsonObject(key), service);
                    break;

                default:
                    break;
                }
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Tries to read element from XML.
        /// </summary>
        /// <param name="reader">The reader.</param>
        /// <returns>True if appropriate element was read.</returns>
        internal override bool TryReadElementFromXml(EwsServiceXmlReader reader)
        {
            switch (reader.LocalName)
            {
            case XmlElementNames.OofState:
                this.state = reader.ReadValue <OofState>();
                return(true);

            case XmlElementNames.ExternalAudience:
                this.externalAudience = reader.ReadValue <OofExternalAudience>();
                return(true);

            case XmlElementNames.Duration:
                this.duration = new TimeWindow();
                this.duration.LoadFromXml(reader);
                return(true);

            case XmlElementNames.InternalReply:
                this.internalReply = new OofReply();
                this.internalReply.LoadFromXml(reader, reader.LocalName);
                return(true);

            case XmlElementNames.ExternalReply:
                this.externalReply = new OofReply();
                this.externalReply.LoadFromXml(reader, reader.LocalName);
                return(true);

            default:
                return(false);
            }
        }
Ejemplo n.º 4
0
        public static void GetOOF(ExchangeService service)
        {
            // Return the Out Of Office object that contains OOF state for the user whose credendials were supplied at the console.
            // This method will result in a call to the Exchange Server.
            OofSettings userOOFSettings = service.GetUserOofSettings(UserDataFromConsole.GetUserData().EmailAddress);

            // Get the (read-only) audience of email message senders outside a client's organization who will receive automatic Out Of Office replies ("All", "Known", or "None").
            OofExternalAudience allowedExternalAudience = userOOFSettings.AllowExternalOof;

            // Get the duration for a scheduled Out Of Office reply.
            TimeWindow OOFDuration = userOOFSettings.Duration;

            // Get the ExternalAudience of email message senders outside a client's organization who will receive automatic Out OF Office replies (All/Known/None).
            OofExternalAudience externalAudience = userOOFSettings.ExternalAudience;

            // Get the reply to be sent to email message senders outside a client's organization.
            OofReply externalReply = userOOFSettings.ExternalReply;

            // Get the reply to be sent to email message senders inside a client's organization.
            OofReply internalReply = userOOFSettings.InternalReply;

            // Get the (Disabled/Enabled/Scheduled) state of the Out Of Office automatic reply feature.
            OofState userOofState = userOOFSettings.State;

            // Print user status information to the console
            Console.WriteLine("Allowed External Audience: {0}", allowedExternalAudience);
            Console.WriteLine("Out of Office duration: {0}", OOFDuration);
            Console.WriteLine("External Audience: {0}", externalAudience);
            Console.WriteLine("External Reply: {0}", externalReply);
            Console.WriteLine("Internal Reply: {0}", internalReply);
            Console.WriteLine("User OOF state: {0}", userOofState);
        }
Ejemplo n.º 5
0
        //gavdcodeend 13

        //gavdcodebegin 14
        static void GetOutOfOfficeConfig(ExchangeService ExService)
        {
            OofSettings myOOFConfig = ExService.GetUserOofSettings("*****@*****.**");

            OofExternalAudience myAllowedExternalAudience = myOOFConfig.AllowExternalOof;

            Console.WriteLine(myAllowedExternalAudience.ToString());

            TimeWindow myOOFDuration = myOOFConfig.Duration;

            if (myOOFDuration != null)
            {
                Console.WriteLine(myOOFDuration.StartTime.ToLocalTime() + " - " +
                                  myOOFDuration.EndTime.ToLocalTime());
            }

            OofExternalAudience myExternalAudience = myOOFConfig.ExternalAudience;

            Console.WriteLine(myExternalAudience.ToString());

            OofReply myExternalReply = myOOFConfig.ExternalReply;

            if (myExternalReply != null)
            {
                Console.WriteLine(myExternalReply.ToString());
            }

            OofReply myInternalReply = myOOFConfig.InternalReply;

            if (myInternalReply != null)
            {
                Console.WriteLine(myInternalReply.ToString());
            }

            OofState myOofState = myOOFConfig.State;

            Console.WriteLine(myOofState.ToString());
        }