예제 #1
0
        /// <summary>
        /// Get the complete list of meetings
        /// </summary>
        /// <returns></returns>
        public IEnumerable <MeetingSummary> GetMeetingList()
        {
            var    bodyContentElem = new XElement(strBodyContent);
            string xml             = XMLUtil.GetFullXML(bodyContentElem, strReqMeetingList);
            string result          = new RequestManager().GetResponse(xml);

            System.IO.File.WriteAllText("C:/ztmp/aa.xml", result);


            XDocument doc = XDocument.Parse(result);

            WebExErrorDetails err = GetErrorDetails(doc);

            if (err != null)
            {
                throw new WebExException(err);
            }

            XNamespace nsMeet = strNamespaceMeet;
            var        nodes  = doc.Descendants(nsMeet + "meeting").Select(elem => new MeetingSummary
            {
                ConfName    = elem.Element(nsMeet + "confName").Value,
                HostWebExID = elem.Element(nsMeet + "hostWebExID").Value,
                MeetingKey  = int.Parse(elem.Element(nsMeet + "meetingKey").Value),
                StartDate   = DateTime.ParseExact(elem.Element(nsMeet + "startDate").Value, dateFormat, CultureInfo.InvariantCulture),
                Duration    = int.Parse(elem.Element(nsMeet + "duration").Value)
            }).ToList();

            return(nodes);
        }
예제 #2
0
        public string GetUrlOfMeeting(bool joinAsHost, int meetingKey)
        {
            var    bodyContentElem = new XElement(strBodyContent, new XElement("meetingKey", meetingKey));
            string xml             = XMLUtil.GetFullXML(bodyContentElem, joinAsHost ? strReqHostUrl : strReqJoinUrl);
            string result          = new RequestManager().GetResponse(xml);

            System.IO.File.WriteAllText("C:/ztmp/aa2.xml", result);

            XDocument         doc = XDocument.Parse(result);
            WebExErrorDetails err = GetErrorDetails(doc);

            if (err != null)
            {
                throw new WebExException(err);
            }
            XNamespace nsMeet = strNamespaceMeet;
            XNamespace nsServ = strNamespaceServ;

            XElement elemContent = doc.Descendants(nsServ + "bodyContent").FirstOrDefault();

            string nodeName = joinAsHost ? "hostMeetingURL" :"joinMeetingURL";

            string url = elemContent.Element(nsMeet + nodeName).Value;

            return(url);
        }
예제 #3
0
        /// <summary>
        /// Get a meeting by ID
        /// </summary>
        /// <param name="meetingKey"></param>
        /// <returns></returns>
        public Meeting GetMeeting(int meetingKey)
        {
            var    bodyContentElem = new XElement(strBodyContent, new XElement("meetingKey", meetingKey));
            string xml             = XMLUtil.GetFullXML(bodyContentElem, strReqMeeting);
            string result          = new RequestManager().GetResponse(xml);

            System.IO.File.WriteAllText("C:/ztmp/aa2.xml", result);

            XDocument         doc = XDocument.Parse(result);
            WebExErrorDetails err = GetErrorDetails(doc);

            if (err != null)
            {
                throw new WebExException(err);
            }
            XNamespace nsMeet = strNamespaceMeet, nsAtt = strNamespaceAtt;
            XNamespace nsServ = strNamespaceServ, nsCom = strNamespaceCom;
            Meeting    meet = new Meeting();

            XElement elemContent = doc.Descendants(nsServ + "bodyContent").FirstOrDefault();

            meet.ConfName    = elemContent.Element(nsMeet + "metaData").Element(nsMeet + "confName").Value;
            meet.MeetingKey  = int.Parse(elemContent.Element(nsMeet + "meetingkey").Value);
            meet.HostWebExID = elemContent.Element(nsMeet + "schedule").Element(nsMeet + "hostWebExID").Value;
            meet.StartDate   = DateTime.ParseExact(elemContent.Element(nsMeet + "schedule").Element(nsMeet + "startDate").Value
                                                   , dateFormat, CultureInfo.InvariantCulture);
            meet.Duration = int.Parse(elemContent.Element(nsMeet + "schedule").Element(nsMeet + "duration").Value);

            meet.Attendees = elemContent.Element(nsMeet + "participants").Element(nsMeet + "attendees")
                             .Elements(nsMeet + "attendee")
                             .Select(attendeeElem => attendeeElem.Element(nsAtt + "person")
                                     .Element(nsCom + "email").Value)
                             .ToList();
            return(meet);
        }
예제 #4
0
        /// <summary>
        /// Create a meeting
        /// </summary>
        /// <param name="meet"></param>
        /// <returns>Meeting key</returns>
        public int CreateMeeting(Meeting meet)
        {
            XElement elemAccessControl = new XElement("accessControl", new XElement("meetingPassword", meet.Password));
            XElement elemMetaData      = new XElement("metaData", new XElement("confName", meet.ConfName)
                                                      , new XElement("agenda", meet.Agenda));
            XElement elemParticipant = new XElement("participants",
                                                    new XElement("attendees",
                                                                 meet.Attendees.Select(em => new XElement("attendee", new XElement("person",
                                                                                                                                   new XElement("email", em)
                                                                                                                                   )
                                                                                                          )
                                                                                       )
                                                                 )
                                                    );

            XElement elemEnableOption = new XElement("enableOptions", new[] { "chat", "poll", "audioVideo" }.Select(e => new XElement(e, "true")));
            XElement elemSchedule     = new XElement("schedule",
                                                     new XElement("startDate", meet.StartDate.ToString(dateFormat, CultureInfo.InvariantCulture)),
                                                     new XElement("duration", meet.Duration)
                                                     );


            var bodyContentElem = new XElement(strBodyContent, elemAccessControl, elemMetaData, elemParticipant, elemEnableOption, elemSchedule);

            string xml = XMLUtil.GetFullXML(bodyContentElem, strReqCreateMeeting);

            System.IO.File.WriteAllText("C:/ztmp/req3.xml", xml);
            string result = new RequestManager().GetResponse(xml);

            System.IO.File.WriteAllText("C:/ztmp/aa3.xml", result);

            XDocument         doc = XDocument.Parse(result);
            WebExErrorDetails err = GetErrorDetails(doc);

            if (err != null)
            {
                throw new WebExException(err);
            }
            XNamespace nsMeet = strNamespaceMeet;
            XNamespace nsServ = strNamespaceServ;

            XElement elemContent = doc.Descendants(nsServ + "bodyContent").FirstOrDefault();

            int meetingID = int.Parse(elemContent.Element(nsMeet + "meetingkey").Value);

            return(meetingID);
        }
예제 #5
0
        public bool UpdateMeeting(Meeting meet)
        {
            bool     success      = true;
            XElement elemMetaData = new XElement("metaData", new XElement("confName", meet.ConfName)
                                                 , new XElement("agenda", meet.Agenda));

            XElement elemParticipant = new XElement("participants",
                                                    new XElement("attendees",
                                                                 meet.Attendees.Select(em => new XElement("attendee", new XElement("person",
                                                                                                                                   new XElement("email", em)
                                                                                                                                   )
                                                                                                          )
                                                                                       )
                                                                 )
                                                    );

            XElement elemEnableOption = new XElement("enableOptions", new[] { "chat", "poll", "audioVideo" }.Select(e => new XElement(e, "true")));

            XElement elemSchedule = new XElement("schedule",
                                                 new XElement("startDate", meet.StartDate.ToString(dateFormat, CultureInfo.InvariantCulture)),
                                                 new XElement("duration", meet.Duration)
                                                 );

            XElement elemMeetingKey = new XElement("meetingkey", meet.MeetingKey);

            var bodyContentElem = new XElement(strBodyContent, elemMetaData, elemParticipant, elemEnableOption, elemSchedule, elemMeetingKey);

            string xml = XMLUtil.GetFullXML(bodyContentElem, strReqUpdateMeeting);

            System.IO.File.WriteAllText("C:/ztmp/req4.xml", xml);
            string result = new RequestManager().GetResponse(xml);

            System.IO.File.WriteAllText("C:/ztmp/aa4.xml", result);

            XDocument         doc = XDocument.Parse(result);
            WebExErrorDetails err = GetErrorDetails(doc);

            if (err != null)
            {
                throw new WebExException(err);
            }

            return(success);
        }
예제 #6
0
        /// <summary>
        /// Check if the request is valid
        /// </summary>
        /// <param name="xdoc"></param>
        /// <returns>Error if request failed, null on successful request</returns>
        private WebExErrorDetails GetErrorDetails(XDocument xdoc)
        {
            XNamespace nsServ = strNamespaceServ;

            XElement respNode = xdoc.Descendants(nsServ + "response").FirstOrDefault();

            if (respNode != null && respNode.Element(nsServ + "result").Value != "FAILURE")
            {
                return(null);
            }
            else
            {
                var error = new WebExErrorDetails {
                    ExceptionID = int.Parse(respNode.Element(nsServ + "exceptionID").Value),
                    Reason      = respNode.Element(nsServ + "reason").Value
                };

                return(error);
            }
        }
예제 #7
0
        public bool CreateAttendee(string name, string email, string meetingKey)
        {
            bool success = true;

            XElement elemPerson = new XElement("person", new XElement("name", name), new XElement("email", email));

            XElement elemMeetingKey = new XElement("meetingKey", meetingKey);

            var bodyContentElem = new XElement(strBodyContent, elemPerson, elemMeetingKey);

            string    xml    = XMLUtil.GetFullXML(bodyContentElem, strReqCreateAttendee);
            string    result = new RequestManager().GetResponse(xml);
            XDocument doc    = XDocument.Parse(result);

            WebExErrorDetails err = GetErrorDetails(doc);

            if (err != null)
            {
                throw new WebExException(err);
            }

            return(success);
        }
예제 #8
0
 public WebExException(WebExErrorDetails err, Exception inner) : base(err.Reason, inner)
 {
     WebExError = err;
 }
예제 #9
0
 public WebExException(WebExErrorDetails err) : base(err.Reason)
 {
     WebExError = err;
 }
예제 #10
0
 public WebExException(WebExErrorDetails err, Exception inner)
     : base(err.Reason, inner)
 {
     WebExError = err;
 }
예제 #11
0
 public WebExException(WebExErrorDetails err)
     : base(err.Reason)
 {
     WebExError = err;
 }
예제 #12
0
        /// <summary>
        /// Check if the request is valid
        /// </summary>
        /// <param name="xdoc"></param>
        /// <returns>Error if request failed, null on successful request</returns>
        private WebExErrorDetails GetErrorDetails(XDocument xdoc)
        {
            XNamespace nsServ = strNamespaceServ;

            XElement respNode = xdoc.Descendants(nsServ + "response").FirstOrDefault();

            if (respNode != null && respNode.Element(nsServ + "result").Value != "FAILURE")
            {
                return null;
            }
            else
            {
                var error = new WebExErrorDetails {  ExceptionID = int.Parse(respNode.Element(nsServ + "exceptionID").Value),
                                              Reason = respNode.Element(nsServ + "reason").Value };

                return error;
            }
        }