Exemple #1
0
        ///
        /// <summary>
        /// Read all active subscriptions
        /// </summary>
        ///
        /// <param name="values">
        ///   <b>Dictionary<string, string></b>
        ///   A dictionary to hold all parameters.
        ///   <list type="bullet">
        ///     <item>
        ///       <c>values["type"]</c> <b>string</b> Type of conversation. Possible value(s) - sms. Check conversation.types for more options
        ///     </item>
        ///   </list>
        /// </param>
        public ConversationResponse GetSubscriptions(Dictionary <string, string> values)
        {
            if (values["type"] == types.SMS)
            {
                var response             = api.SendRequest($"{baseUrl}/inbound/subscriptions", new JObject());
                var conversationResponse = new ConversationResponse(api, response);

                conversationResponse.Process((JObject res) => {
                    if (res["data"]["subscriptionList"] != null)
                    {
                        conversationResponse.subscriptions = new List <Subscription>();
                        foreach (var subscription in res["data"]["subscriptionList"]["subscription"])
                        {
                            conversationResponse.subscriptions.Add(new Subscription((JObject)subscription));
                        }
                    }

                    return(null);
                });

                return(conversationResponse);
            }

            return(null);
        }
    void ReadElementsFromXml(EwsServiceXmlReader reader)
    {
        this.Conversation = new ConversationResponse(this.propertySet);

        reader.ReadStartElement(XmlNamespace.Messages, XmlElementNames.Conversation);
        this.Conversation.LoadFromXml(reader, XmlNamespace.Messages, XmlElementNames.Conversation);
    }
        public ConversationResponse ConversationList(int objectId, int userid)
        {
            ConversationResponse resp        = new ConversationResponse();
            IService             itemService = new Service();

            resp = itemService.GetConversationList(objectId, userid);
            return(resp);
        }
        public void DeserializeConversationResponse()
        {
            string json = TestData["MessageConversationResponse.json"];
            ConversationResponse response = NewtonsoftJsonSerializer
                                            .Create(JsonNamingStrategy.CamelCase)
                                            .Deserialize <ConversationResponse>(json);

            Assert.IsNotNull(response.Conversation);
            Assert.IsNotNull(response.Conversation.Summary);
            Assert.IsNull(response.Conversation.Summary.LastMessage);
            Assert.IsNotNull(response.Conversation.Messages);
            Assert.IsNotEmpty(response.Conversation.Messages);
            Assert.AreEqual(2, response.Conversation.Messages.Length);
        }
Exemple #5
0
        ///
        /// <summary>
        /// Send a new outbound message
        /// </summary>
        ///
        /// <param name="destinationAddress"> <b>string | Array<string></b> Indicates which DID number(s) used as destination for this SMS. </param>
        /// <param name="values">
        ///   <b>Dictionary<string, string></b>
        ///   A dictionary to hold all parameters.
        ///   <list type="bullet">
        ///     <item>
        ///       <c>values["type"]</c> <b>string</b> Type of conversation. Possible value(s) - sms. Check conversation.types for more options
        ///     </item>
        ///     <item>
        ///       <c>values["senderAddress"]</c> <b>string</b> Sender address information, basically the from address. E164 formatted DID number passed as a value, which is owned by the user. If the user wants to let CPaaS uses the default assigned DID number, then this field should have "default" as it's value.
        ///     </item>
        ///     <item>
        ///       <c>values["message"]</c> <b>string</b> SMS text message.
        ///     </item>
        ///   </list>
        /// </param>
        ///
        /// <returns>
        ///  ConversationResponse
        /// </returns>
        ///
        public ConversationResponse CreateMessage(dynamic destinationAddress, Dictionary <string, string> values)
        {
            if (values["type"] == types.SMS)
            {
                JArray addresses = new JArray();

                if (destinationAddress is System.Array)
                {
                    addresses = JArray.FromObject(destinationAddress);
                }
                else
                {
                    addresses.Add(destinationAddress);
                }

                var body = new JObject {
                    ["outboundSMSMessageRequest"] = new JObject {
                        ["address"]                = addresses,
                        ["clientCorrelator"]       = api.config.clientCorrelator,
                        ["outboundSMSTextMessage"] = new JObject {
                            ["message"] = Util.ExtractFrom(values, "message")
                        }
                    }
                };

                var options = new JObject()
                {
                    ["body"] = body
                };

                var response             = api.SendRequest($"{baseUrl}/outbound/{Util.ExtractFrom(values, "senderAddress")}/requests", options, "post");
                var conversationResponse = new ConversationResponse(api, response);

                conversationResponse.Process((JObject res) => {
                    var data = res["data"]["outboundSMSMessageRequest"];

                    conversationResponse.senderAddress = data["address"].ToObject <List <string> >();
                    conversationResponse.deliveryInfo  = data["deliveryInfoList"]["deliveryInfo"].ToObject <List <DeliveryInfo> >();
                    conversationResponse.sentMessage   = (string)data["outboundSMSTextMessage"]["message"];

                    return(null);
                });

                return(conversationResponse);
            }

            return(null);
        }
Exemple #6
0
        ///
        /// <summary>
        /// Unsubscription from conversation notification
        /// </summary>
        ///
        /// <param name="values">
        ///   <b>Dictionary<string, string></b>
        ///   A dictionary to hold all parameters.
        ///   <list type="bullet">
        ///     <item>
        ///       <c>values["type"]</c> <b>string</b> Type of conversation. Possible value(s) - sms. Check conversation.types for more options
        ///     </item>
        ///     <item>
        ///       <c>values["subscriptionId"]</c> <b>string</b> Resource ID of the subscription
        ///     </item>
        ///   </list>
        /// </param>
        ///
        public ConversationResponse Unsubscribe(Dictionary <string, string> values)
        {
            if (values["type"] == types.SMS)
            {
                var response             = api.SendRequest($"{baseUrl}/inbound/subscriptions/{Util.ExtractFrom(values, "subscriptionId")}", new JObject(), "delete");
                var conversationResponse = new ConversationResponse(api, response);

                conversationResponse.Process((JObject res) => {
                    return(null);
                });

                return(conversationResponse);
            }

            return(null);
        }
        public async Task <ConversationResponse> Representative([FromBody] MessagePayload payload)
        {
            //var sentiment = await AzureLanguage.ProcessSentiment(payload.messages.Select(x => x.message).ToList());
            var entities = await AzureLanguage.ProcessLinkedEntities(payload.messages.Select(x => x.message).ToList());

            //var language = await AzureLanguage.ProcessLanguage(payload.messages.Select(x => x.message).ToList());
            //var energy = await AzureLanguage.ProcessEnergy();

            var response = new ConversationResponse();

            //response.sentiment = sentiment;
            response.entities = entities;
            //response.language = language;
            //response.energy = energy;

            return(response);
        }
Exemple #8
0
        public bool TryInvoke(string methodName, ref ConversationResponse response, string payload = null)
        {
            response = null;
            MethodInfo mi = this.GetType().GetMethod(methodName);

            if (mi != null)
            {
                var res = mi.Invoke(this, new object[] { payload });
                if (res is ConversationResponse convResponse)
                {
                    response = convResponse;
                    return(true);
                }
            }

            return(false);
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                base.OnCreate(savedInstanceState);
                Window.RequestFeature(WindowFeatures.NoTitle);
                SetContentView(Resource.Layout.ConversationLayout);
                ServiceWrapper svc = new ServiceWrapper();
                InsertMessages ins = new InsertMessages();
                SenderList   = FindViewById <ListView>(Resource.Id.senderList);
                ReceiverList = FindViewById <ListView>(Resource.Id.receiverList);

                ConversationResponse cvr = new ConversationResponse();
                cvr   = svc.GetConversationList(1, 2).Result;
                myArr = cvr.ConversationList.ToList <RetriveMessages>();
                SenderListAdapter adapter = new SenderListAdapter(this, myArr);
                SenderList.Adapter = adapter;
                ConversationResponse cvr1 = new ConversationResponse();
                cvr1   = svc.GetConversationList(2, 1).Result;
                myArr1 = cvr1.ConversationList.ToList <RetriveMessages>();
                ReceiverListAdapter adapter1 = new ReceiverListAdapter(this, myArr1);
                ReceiverList.Adapter = adapter1;

                EditText    ed      = FindViewById <EditText>(Resource.Id.txtmsg);
                ImageButton btnsend = FindViewById <ImageButton>(Resource.Id.btnSend);
                btnsend.Click += async delegate
                {
                    ins.InsertMessage = ed.Text;
                    ins.sender_id     = 2;//Convert.ToInt32(CurrentUser.getUserId());
                    ins.receiver_id   = 1;
                    int i = await svc.InsertMessage(ins);

                    try
                    {
                        RefreshParent();
                    }
                    catch (Exception e)
                    {
                    }
                    ed.Dispose();
                };
            }
            catch (Exception e)
            {
            }
        }
Exemple #10
0
        ///
        /// <summary>
        /// Read all messages in a thread
        /// </summary>
        ///
        /// <param name="values">
        ///   <b>Dictionary<string, string></b>
        ///   A dictionary to hold all parameters.
        ///   <list type="bullet">
        ///     <item>
        ///       <c>values["type"]</c> <b>string</b> Type of conversation. Possible value(s) - sms. Check conversation.types for more options
        ///     </item>
        ///     <item>
        ///       <c>values["remoteAddress"]</c> <b>string</b> <i>Optional</i> Remote address information while retrieving the conversation history, basically the destination telephone number that user exchanged message before. E164 formatted DID number passed as a value.
        ///     </item>
        ///     <item>
        ///       <c>values["localAddress"]</c> <b>string</b> <i>Optional</i> Local address information while retrieving the conversation history, basically the source telephone number that user exchanged message before.
        ///     </item>
        ///   </list>
        /// </param>
        ///
        /// <param name="query">
        ///   <b>Dictionary<string, string></b> <i>Optional</i>
        ///   A dictionary to hold all parameters.
        ///   <list type="bullet">
        ///     <item>
        ///       <c>query["name"]</c> <b>string</b> <i>Optional</i> Performs search operation on firstName and lastName fields.
        ///     </item>
        ///     <item>
        ///       <c>query["firstName"]</c> <b>string</b> <i>Optional</i> Performs search for the firstName field of the directory items.
        ///     </item>
        ///     <item>
        ///       <c>query["lastName"]</c> <b>string</b> <i>Optional</i> Performs search for the lastName field of the directory items.
        ///     </item>
        ///     <item>
        ///       <c>query["userName"]</c> <b>string</b> <i>Optional</i> Performs search for the userName field of the directory items.
        ///     </item>
        ///     <item>
        ///       <c>query["phoneNumber"]</c> <b>string</b> <i>Optional</i> Performs search for the fields containing a phone number, like businessPhoneNumber, homePhoneNumber, mobile, pager, fax.
        ///     </item>
        ///     <item>
        ///       <c>query["order"]</c> <b>string</b> <i>Optional</i> Ordering the contact results based on the requested sortBy value, order query parameter should be accompanied by sortBy query parameter.
        ///     </item>
        ///     <item>
        ///       <c>query["sortBy"]</c> <b>string</b> <i>Optional</i> value is used to detect sorting the contact results based on which attribute. If order is not provided with that, ascending order is used.
        ///     </item>
        ///     <item>
        ///       <c>query["max"]</c> <b>string</b> <i>Optional</i> Maximum number of contact results that has been requested from CPaaS for this query.
        ///     </item>
        ///     <item>
        ///       <c>query["next"]</c> <b>string</b> <i>Optional</i> Pointer for the next chunk of contacts, should be gathered from the previous query results.
        ///     </item>
        ///   </list>
        /// </param>
        ///
        /// <returns>
        ///  ConversationResponse
        /// </returns>
        ///
        public ConversationResponse GetMessagesInThread(Dictionary <string, string> values, Dictionary <string, string> query = null)
        {
            if (values["type"] == types.SMS)
            {
                var options = new JObject();
                var url     = $"{baseUrl}/remoteAddresses";

                if (values.ContainsKey("remoteAddress"))
                {
                    url += $"/{values["remoteAddress"]}";
                }

                if (values.ContainsKey("localAddress"))
                {
                    url += $"/localAddresses/{values["localAddress"]}";
                }

                if (query != null)
                {
                    options.Add("query", JObject.FromObject(query));
                }

                var response             = api.SendRequest(url, options, "get");
                var conversationResponse = new ConversationResponse(api, response);

                conversationResponse.Process((JObject res) => {
                    if (res["data"]["smsThreadList"] != null)
                    {
                        conversationResponse.smsThreads = res["data"]["smsThreadList"]["smsThread"].ToObject <List <SmsThread> >();
                    }

                    if (res["data"]["smsThread"] != null)
                    {
                        conversationResponse.smsThread = res["data"]["smsThread"].ToObject <SmsThread>();
                    }

                    return(null);
                });

                return(conversationResponse);
            }

            return(null);
        }
        public ConversationResponse GetConversationList(int SenderID, int ReceiverID)
        {
            ConversationResponse   itemListResponse = new ConversationResponse();
            List <RetriveMessages> itemList         = new List <RetriveMessages>();

            IDBManager itemDBManager = new DBManager();

            IList <MyMessagesResult> wineResults = itemDBManager.GetMessageList(SenderID, ReceiverID).ToList();

            foreach (MyMessagesResult result in wineResults)
            {
                itemList.Add(new RetriveMessages
                {
                    Conversation = result.message
                });
            }
            itemListResponse.ConversationList = itemList;
            return(itemListResponse);
        }
Exemple #12
0
        ///
        /// <summary>
        /// Gets all messages.
        /// </summary>
        ///
        /// <param name="values">
        ///   <b>Dictionary<string, string></b>
        ///   A dictionary to hold all parameters.
        ///   <list type="bullet">
        ///     <item>
        ///       <c>values["type"]</c> <b>string</b> Type of conversation. Possible value(s) - sms. Check conversation.types for more options
        ///     </item>
        ///     <item>
        ///       <c>values["remoteAddress"]</c> <b>string</b> Remote address information while retrieving the conversation history, basically the destination telephone number that user exchanged message before. E164 formatted DID number passed as a value.
        ///     </item>
        ///     <item>
        ///       <c>values["localAddress"]</c> <b>string</b> Local address information while retrieving the conversation history, basically the source telephone number that user exchanged message before.
        ///     </item>
        ///   </list>
        /// </param>
        ///
        public ConversationResponse GetStatus(Dictionary <string, string> values)
        {
            if (values["type"] == types.SMS)
            {
                var url = $"{baseUrl}/remoteAddresses/{Util.ExtractFrom(values, "remoteAddress")}/localAddresses/{Util.ExtractFrom(values, "localAddress")}/messages/{Util.ExtractFrom(values, "messageId")}/status";

                var response             = api.SendRequest(url, new JObject());
                var conversationResponse = new ConversationResponse(api, response);

                conversationResponse.Process((JObject res) => {
                    conversationResponse.status = (string)res["data"]["status"];

                    return(null);
                });

                return(conversationResponse);
            }

            return(null);
        }
        private void setDisplayedPage(ConversationResponse result)
        {
            displayedPage = result;
            listView1.Items.Clear();
            foreach(var i in result.Conversations)
            {
                var item = new ListViewItem();
                item.Text = i.Id;
                item.SubItems.Add(i.Version.ToString());
                if(i.ThreadProperties != null)
                {
                    item.SubItems.Add("Thread");
                }
                else
                {
                    item.SubItems.Add("Conversation");
                }
                if(i.LastMessage != null)
                {
                    item.SubItems.Add((i.LastMessage["content"] ?? "").ToString());
                }
                else
                {
                    item.SubItems.Add("");
                }
                if(i.ThreadProperties != null)
                {
                    item.SubItems.Add(i.ThreadProperties["topic"].ToString());
                }
                else
                {
                    item.SubItems.Add("");
                }
                listView1.Items.Add(item);
            }

            btnGetBack.Enabled = !string.IsNullOrWhiteSpace(result.BackwardLink);
            btnGetSync.Enabled = !string.IsNullOrWhiteSpace(result.SyncState);
            btnGetForward.Enabled = !string.IsNullOrWhiteSpace(result.ForwardLink);
        }
Exemple #14
0
        ///
        /// <summary>
        /// Gets all messages.
        /// </summary>
        ///
        /// <param name="values">
        ///   <b>Dictionary<string, string></b>
        ///   A dictionary to hold all parameters.
        ///   <list type="bullet">
        ///     <item>
        ///       <c>values["type"]</c> <b>string</b> Type of conversation. Possible value(s) - sms. Check conversation.types for more options
        ///     </item>
        ///     <item>
        ///       <c>values["remoteAddress"]</c> <b>string</b> Remote address information while retrieving the conversation history, basically the destination telephone number that user exchanged message before. E164 formatted DID number passed as a value.
        ///     </item>
        ///     <item>
        ///       <c>values["localAddress"]</c> <b>string</b> Local address information while retrieving the conversation history, basically the source telephone number that user exchanged message before.
        ///     </item>
        ///     <item>
        ///       <c>values["messageId"]</c> <b>string</b> <i>Optional</i> Identification of the message.
        ///     </item>
        ///   </list>
        /// </param>
        ///
        /// <param name="query">
        ///   <b>Dictionary<string, string></b> <i>Optional</i>
        ///   A dictionary to hold all parameters.
        ///   <list type="bullet">
        ///     <item>
        ///       <c>query["lastMessageTime"]</c> <b>string</b> <i>Optional</i> Filters the messages or threads having messages that are sent/received after provided Epoch time
        ///     </item>
        ///     <item>
        ///       <c>query["new"]</c> <b>string</b> <i>Optional</i> Filters the messages or threads having messages that are not received by the user yet.
        ///     </item>
        ///     <item>
        ///       <c>query["max"]</c> <b>string</b> <i>Optional</i> Maximum number of contact results that has been requested from CPaaS for this query.
        ///     </item>
        ///     <item>
        ///       <c>query["next"]</c> <b>string</b> <i>Optional</i> Pointer for the next chunk of contacts, should be gathered from the previous query results.
        ///     </item>
        ///   </list>
        /// </param>
        ///
        /// <returns>
        ///  ConversationResponse
        /// </returns>
        ///
        public ConversationResponse GetMessages(Dictionary <string, string> values, Dictionary <string, string> query = null)
        {
            if (values["type"] == types.SMS)
            {
                var url     = $"{baseUrl}/remoteAddresses/{Util.ExtractFrom(values, "remoteAddress")}/localAddresses/{Util.ExtractFrom(values, "localAddress")}/messages";
                var options = new JObject();

                if (query != null && !values.ContainsKey("messageId"))
                {
                    options.Add("query", JObject.FromObject(query));
                }

                if (values.ContainsKey("messageId"))
                {
                    url += $"/messages/{values["messageId"]}";
                }

                var response             = api.SendRequest(url, options);
                var conversationResponse = new ConversationResponse(api, response);

                conversationResponse.Process((JObject res) => {
                    if (res["data"]["smsMessageList"] != null)
                    {
                        conversationResponse.smsMessages = res["data"]["smsMessageList"]["smsMessage"].ToObject <List <SmsMessage> >();
                    }

                    if (res["data"]["smsMessage"] != null)
                    {
                        conversationResponse.smsMessage = res["data"]["smsMessage"].ToObject <SmsMessage>();
                    }

                    return(null);
                });

                return(conversationResponse);
            }

            return(null);
        }
 public void RefreshParent()
 {
     try
     {
         ServiceWrapper       svc = new ServiceWrapper();
         ConversationResponse cvr = new ConversationResponse();
         cvr   = svc.GetConversationList(Convert.ToInt32(CurrentUser.getUserId()), 2).Result;
         myArr = cvr.ConversationList.ToList <RetriveMessages>();
         SenderListAdapter adapter = new SenderListAdapter(this, myArr);
         SenderList.Adapter = adapter;
         adapter.NotifyDataSetChanged();
         ConversationResponse cvr1 = new ConversationResponse();
         cvr1   = svc.GetConversationList(2, Convert.ToInt32(CurrentUser.getUserId())).Result;
         myArr1 = cvr1.ConversationList.ToList <RetriveMessages>();
         ReceiverListAdapter adapter1 = new ReceiverListAdapter(this, myArr1);
         ReceiverList.Adapter = adapter1;
         adapter1.NotifyDataSetChanged();
     }
     catch (Exception e)
     {
     }
 }
        public async Task <ConversationResponse> Energy()
        {
            var energy = await AzureLanguage.ProcessEnergy();

            var response = new ConversationResponse();

            //response.sentiment = sentiment;
            //response.entities = entities;

            double[] typical = new double[336];
            double[] counts  = new double[336];

            energy = energy.OrderBy(y => y.Timestamp).ToList();

            int i = 0;

            foreach (var e in energy.Take(energy.Count() - 336).Select(y => y.PrimaryValue))
            {
                typical[i] += e;
                counts[i]++;
                i++;
                if (i > 335)
                {
                    i = 0;
                }
            }

            for (int j = 0; j < 336; j++)
            {
                typical[j] = typical[j] / (counts[j]);
            }


            response.energyCurrent = energy.Skip(energy.Count - 336).Take(336).Select(x => x.PrimaryValue).ToList();
            response.energyTypical = energy.Take(336).Select(x => x.PrimaryValue).ToList();
            response.energyTypical = typical.ToList();
            return(response);
        }
Exemple #17
0
        ///
        /// <summary>
        /// Create a new subscription
        /// </summary>
        ///
        /// <param name="values">
        ///   <b>Dictionary<string, string></b>
        ///   A dictionary to hold all parameters.
        ///   <list type="bullet">
        ///     <item>
        ///       <c>values["type"]</c> <b>string</b> Type of conversation. Possible value(s) - sms. Check conversation.types for more options
        ///     </item>
        ///     <item>
        ///       <c>values["webhookURL"]</c> <b>string</b> HTTPS URL that is present in your application server which is accessible from the public web where the notifications should be sent to. Note: Should be a POST endpoint.
        ///     </item>
        ///     <item>
        ///       <c>values["destinationAddress"]</c> <b>string</b> <i>Optional</i> The address that incoming messages are received for this subscription. If does not exist, CPaaS uses the default assigned DID number to subscribe against. It is suggested to provide the intended E164 formatted DID number within this parameter.
        ///     </item>
        ///   </list>
        /// </param>
        ///
        public ConversationResponse Subscribe(Dictionary <string, string> values)
        {
            if (values["type"] == types.SMS)
            {
                NotificationChannelResponse channel = new NotificationChannel(api).CreateChannel(values);

                JObject body = new JObject()
                {
                    ["subscription"] = new JObject {
                        ["callbackReference"] = new JObject {
                            ["notifyURL"] = channel.channelId
                        },
                        ["clientCorrelator"]   = api.config.clientCorrelator,
                        ["destinationAddress"] = Util.ExtractFrom(values, "destinationAddress")
                    }
                };

                var options = new JObject()
                {
                    ["body"] = body
                };

                var response             = api.SendRequest($"{baseUrl}/inbound/subscriptions", options, "post");
                var conversationResponse = new ConversationResponse(api, response);

                conversationResponse.Process((JObject res) => {
                    conversationResponse.subscription = new Subscription((JObject)res["data"]["subscription"]);

                    return(null);
                });

                return(conversationResponse);
            }


            return(null);
        }
Exemple #18
0
        ///
        /// <summary>
        /// Delete conversation message
        /// </summary>
        ///
        /// <param name="values">
        ///   <b>Dictionary<string, string></b>
        ///   A dictionary to hold all parameters.
        ///   <list type="bullet">
        ///     <item>
        ///       <c>values["type"]</c> <b>string</b> Type of conversation. Possible value(s) - sms. Check conversation.types for more options
        ///     </item>
        ///     <item>
        ///       <c>values["remoteAddress"]</c> <b>string</b> Remote address information while retrieving the conversation history, basically the destination telephone number that user exchanged message before. E164 formatted DID number passed as a value.
        ///     </item>
        ///     <item>
        ///       <c>values["localAddress"]</c> <b>string</b> Local address information while retrieving the conversation history, basically the source telephone number that user exchanged message before.
        ///     </item>
        ///     <item>
        ///       <c>values["messageId"]</c> <b>string</b> <i>Optional</i> Identification of the message. If messeageId is not passsed then the conversation thread is deleted with all messages.
        ///     </item>
        ///   </list>
        /// </param>
        ///
        public ConversationResponse DeleteMessage(Dictionary <string, string> values)
        {
            if (values["type"] == types.SMS)
            {
                var url     = $"{baseUrl}/remoteAddresses/{Util.ExtractFrom(values, "remoteAddress")}/localAddresses/{Util.ExtractFrom(values, "localAddress")}";
                var options = new JObject();

                if (values.ContainsKey("messageId"))
                {
                    url += $"/messages/{values["messageId"]}";
                }

                var response             = api.SendRequest(url, options, "delete");
                var conversationResponse = new ConversationResponse(api, response);

                conversationResponse.Process((JObject res) => {
                    return(null);
                });

                return(conversationResponse);
            }

            return(null);
        }
 public void Init()
 {
     instance = new ConversationResponse();
 }
Exemple #20
0
        private void mnuGetConversationItems_Click(object sender, EventArgs e)
        {
            List <ItemId> oConversationItems = new List <ItemId>();

            PropertySet    oPropertySet    = null;
            ConversationId oConversationId = null;
            FolderId       oFolderId       = null;

            ConversationIdDialog oConversationIdDialog = new ConversationIdDialog();

            oConversationIdDialog.ShowDialog();

            this.Cursor = Cursors.WaitCursor;

            if (oConversationIdDialog.ChoseOK == true)
            {
                oPropertySet    = oConversationIdDialog.CurrentPropertySet;
                oConversationId = oConversationIdDialog.CurrentConversationId;
                oFolderId       = oConversationIdDialog.CurrentFolderId;

                List <FolderId> folder = new List <FolderId>();
                folder.Add(oFolderId);

                // Identify the folders to ignore.
                Collection <FolderId> foldersToIgnore =
                    new  Collection <FolderId>()
                {
                    WellKnownFolderName.DeletedItems, WellKnownFolderName.Drafts
                };

                ConversationResponse oResponses = null;
                oResponses = CurrentService.GetConversationItems(
                    oConversationId,
                    oPropertySet,
                    null,
                    foldersToIgnore,
                    ConversationSortOrder.TreeOrderDescending
                    );

                //Console.WriteLine("SyncState: " + oResponses.SyncState); // Get the synchronization state of the conversation.


                try {
                    foreach (ConversationNode node in oResponses.ConversationNodes) // Process each node of conversation items.
                    {
                        //Console.WriteLine("Parent conversation index: " + node.ParentConversationIndex);
                        //Console.WriteLine("Conversation index: " + node.ConversationIndex);
                        //Console.WriteLine("Conversation node items:");

                        // Process each item in the conversation node.
                        foreach (Item item in node.Items)
                        {
                            //Console.WriteLine("   Item ID: " + item.Id.UniqueId);
                            //Console.WriteLine("   Subject: " + item.Subject);
                            //Console.WriteLine("   Received: " + item.DateTimeReceived);
                            oConversationItems.Add(item.Id);
                        }
                    }
                }
                catch (ServerBusyException srBusyException)  // 2013+
                {
                    Console.WriteLine(srBusyException);
                }
                // This exception may occur if there is an error with the service.
                catch (ServiceResponseException srException)
                {
                    Console.WriteLine(srException);
                }
                this.Cursor = Cursors.Default;

                ItemsContentForm.Show(
                    "Displaying item by Conversation",
                    oConversationItems,
                    this.CurrentService,
                    this);
            }
        }
Exemple #21
0
 public ConversationResponseEventArgs(ConversationResponse response)
 {
     this.Response = response;
 }