Comments

  • Ryan Young

     

    Thanks, Ryan and Allan.

    I have FINALLY figured it out.  Are you ready for this one??  Here's the fix:

    string sqlQuery = string.Format("SELECT ID FROM Contact WHERE Emails.Address = '{0}'", originalSender[0].ToLower()); 

    By passing the email in all lowercase it works.  I didn't realize that ORN automatically stores email addresses in all lowercase, but after saving the contact with the email in all caps and reopening, I see that it always defaults this way.

    Thank you so much for your help!!

     

  • Ryan Young

    I am still stuck on this one.  The weird thing is that I can do this in reverse.  If I know the c_id, I can pull Emails.Address; however, if I have an email address, I still can not get the c_id back.

     

                        string sqlQuery = string.Format("SELECT ID FROM Contact WHERE Emails.Address = '{0}'", originalSender[0]); //broken
                        string sqlQuery = string.Format("SELECT Emails.Address FROM Contact WHERE ID = '{0}'", "10970061"); //works, returns 3 rows
  • Ryan Young

    Well, it doesn't seem to be returning any data (System.IndexOutOfRangeException) ; however, I think that I have made a good deal of progress.  I will update here once I have this figured out.

    Edit: Querying against the email address is returning a null set.  I am using a contact which was set up specifically for testing, and am passing the exact email address as it exists in the contact record.  When I pass the c_id instead, it returns the correct data.  Not sure why Emails.Address isn't pulling the data, but since it is a list, maybe I am referencing it incorrectly?  I'm looking into SQL SELECT statements which should return a String[] array.

    Here is the code for the database call:

     

     
                        string sqlQuery = string.Format("SELECT ID FROM Contact WHERE Emails.Address = '{0}'", originalSender[0]);//this returns nothing
                        //string sqlQuery = string.Format("SELECT ID FROM Contact WHERE ID = '{0}'", "10970061");//this works
                        CSVTableSet queryCSV = _client.QueryCSV(cIH, sqlQuery, 10000);
                        CSVTable[] csvTables = queryCSV.CSVTables;
                        CSVTable testTable = queryCSV.CSVTables[0];
     
     
                        //parse returned table
                        foreach (CSVTable table in csvTables)
                        {
                            //row data
                            String[] rowData = table.Rows;
                            //get row data
                            foreach (String data in rowData)
                                MessageBox.Show(table.Columns + ": " + data, "Returned DB Data");
                        }
  • Ryan Young

    Wow...  I missed an entire 4 lines of code in the example...  Think I have it now!!

  • Ryan Young

    Thanks, Ryan!

    I am successfully making the SOAP call now, I just have to figure out how to pull the specific column data as opposed to the table/column name.  I'm so close!!  Thank you so much for your help, Ryan.  :)

     

    Sincerely,

    Ryan

  • Ryan Young

    Thank you so much, Diane!!  This totally helped me.  :)  I'm successfully making the call now, I just have to figure out how to get the column value as opposed to the table/column name...  Almost done!  Thank you again!!

     

    Sincerely,

    Ryan

  • Ryan Young

    I replaced the "_globalContext.GetInterfaceServiceUrl(ConnectServiceType.Soap)" with the URI used to set up my Service Reference.  It compiled and I was able to load the incident workspace; however, when I run the add-in, the QueryCSV() method causes an exception ("Failure Retrieving Message").

    I have attached a screen shot of the Fault Exception in case anyone has any insight.  Thank you again for your continued help!

     

    Sincerely,

    Ryan Young

  • Ryan Young

     

    Thanks, Ryan!
     
    I have been trying to get it working, but have run into a couple more problems.  My add-in is still crashing the incident workspace on which it is installed.
     
    My _globalContext does not have a GetInterfaceServiceUrl() method, nor do I have a ConnectServiceType enum.  Is there a 'using' directive which I am missing from the following list?
     
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.AddIn;
    using RightNow.AddIns.AddInViews;
    using System.Windows.Forms;
    using System.Text.RegularExpressions;
    using ProcurementEmailParser.RightNowService;
    using System.ServiceModel;
     
    I have set up my ServiceReference to my site (Feb '11), and I am using Visual Studio 2010.  I tried the method used in the WebServicesSamples code, but that keeps crashing the add-in when the workspace tries to load it.  I then stared to use the code from the post which you mentioned above, but ran into the problem of missing methods and enumerators.  Have you run into this before?
  • Ryan Young

    My add-in keeps crashing the incident workspace on which it is installed.

    My _globalContext does not have a GetInterfaceServiceUrl() method, nor do I have a ConnectServiceType enum.  Is there a 'using' directive which I am missing from the following list?

     

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.AddIn;
    using RightNow.AddIns.AddInViews;
    using System.Windows.Forms;
    using System.Text.RegularExpressions;
    using ProcurementEmailParser.RightNowService;
    using System.ServiceModel;
     
    I have set up my ServiceReference to my site (Feb '11), and I am using Visual Studio 2010.  I tried the method used in the WebServicesSamples code, but that keeps crashing the add-in when the workspace tries to load it.  I then stared to use the code above, but ran into the problem of missing methods and enumerators.  Please help!
  • Ryan Young

    Do I need to set up the service reference differently for a Ribbon add-in vs. a console application?

  • Ryan Young

    Ryan,

    I am working on this, but the actual command to run the CSV query will not compile and gives two error messages:

    1) The best overloaded method match for 'emailParser.RightNowService.RightNowSyncPortClient.QueryCSV(emailParser.RightNowService.ClientInfoHeader, string, int)' has some invalid arguments.

    2) Argument 1: cannot convert from 'emailParser.RightNowService.ClientInfoHeader [file path of project]' to 'emailParser.RightNowService.ClientInfoHeader'.

    I have added the service reference as I did in my console application and believe that I have initiated everything correctly.  Here is the associated code.  If you happen to see anything which needs to be changed (or if you would like my full code), please let me know.  Thank you so much!

     

    namespace emailParser
    {
        public class emailParser: Panel, IWorkspaceRibbonButton
        {
            //...
            private RightNowSyncPortClient _service;
            public emailParser(bool inDesignMode, IRecordContext context, IGlobalContext globalContext)
            {
                //...
                _service = new RightNowSyncPortClient();
                _service.ClientCredentials.UserName.UserName = "****";
                _service.ClientCredentials.UserName.Password = "****";
            }
            #region IWorkspaceRibbonButton Members
            public new void Click()
            {
                //...
                string sqlQuery = string.format("SELECT ID FROM Contact WHERE Email.Address = '{0}'", emailToUse);
                ClientInfoHeader cIH = new ClientIInfoHeader();
                cIH.AppID = "Email Parser";
                //...
                CSVTableSet queryCSV = _service.QueryCSV(cIH, sqlQuery, 100);  //here is the error; the API doc shows a 7 argument function call, but this does not appear to be currently valid for Feb '11(?)
                //...
            }
        }
    }
    
  • Ryan Young

    Thank you so much, Ryan!  :D

    I will implement this and let you know my results.  Thanks again!!

  • Ryan Young

    Here is a screen shot of the actual proof email:

  • Ryan Young

    OK, so now the .Update(...) function is executing successfully, but I can't scrub the email addresses.  Here are some specifics:

    (Contact): Guy

    Emails (all 3): a@b.com.10000, a@b.com, a@b.com.0525

    Here is the pertinent code:

    ***********begin code***************

    //create update options
    UpdateProcessingOptions upo = new UpdateProcessingOptions();
    upo.SuppressExternalEvents = false;
    upo.SuppressRules = false;

    //create new contact
    Contact newContact = new Contact();

    newContact.ID = contact.ID;
    newContact.ID.idSpecified = true;

    Email[] newEmail = new Email[3];
    newEmail[0] = new Email();
    newEmail[1] = new Email();
    newEmail[2] = new Email();
    for (int i = 0; i < 3; i++)
    {
       newEmail[i].action = ActionEnum.update;
       newEmail[i].actionSpecified = true;
       for (int x = 0; x < 3; x++)
       newEmail[x].Address = null;
       NamedID addType = new NamedID();
       ID addTypeID = new ID();
       addTypeID.id = 0;
       addType.ID = addTypeID;
       addType.ID.idSpecified = true;
       newEmail[i].AddressType = addType;
       newEmail[i].Invalid = false;
       newEmail[i].InvalidSpecified = true;
    }
    newContact.Emails = newEmail;

    //create array of objects to update
    RNObject[] updateObjects = new RNObject[] { newContact };
    //update contact
    emailScrubber._service.Update(clientInfoHeader, updateObjects, upo);

    ****************end code**************

    I put a breakpoint at the actual Update() function.  At that point, the emails for newContact are:

    Emails (all 3): a@b.com, "", ""

    After running this, however, the updated contact's emails are:

    Emails (all 3): a@b.com.526, a@b.com, a@b.com.0525

    Any idea why this is happening?

  • Ryan Young

    Ryan,

    One more question (I hope that's all!).  I've been able to loop through the contact database, and I can pull contact data back and display it to a screen.  I can also manipulate it; however, when I actually try to update it [_service.Update(clientInfoHeader, updateObjects, updateOptions)], I am getting a FaultException.  Have you encountered this before?  

    I was supposed to have this completed on Friday.  As far as I can tell, once I get the Update(...,...,...) function to work, it will be ready to go.  Thanks in advance!

     

    Ryan Young