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); } }
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); }
/// <summary> /// Serializes an OofReply. Emits an empty OofReply in case the one passed in is null. /// </summary> /// <param name="oofReply">The oof reply.</param> /// <param name="writer">The writer.</param> /// <param name="xmlElementName">Name of the XML element.</param> /* private */ void SerializeOofReply( OofReply oofReply, EwsServiceXmlWriter writer, String xmlElementName) { if (oofReply != null) { oofReply.WriteToXml(writer, xmlElementName); } else { OofReply.WriteEmptyReplyToXml(writer, xmlElementName); } }
//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()); }