none
How can I get the value from the edit box which is in backstage view into ThisAddin.cs RRS feed

  • General discussion

  • Hi,

    I have developed the Outlook Addin which sents the attachments to the SharePoint library. And I want to provide a configuration to user to provide the site url and library name.

    For this I have added a edit box in backstage view and took these values into a property.

    But I am not able to use these values in ThisAddin.cs class.  Can anyone please suggest me on this.

    If the way which I did is wrong please suggest me how can I give an accessibility to the user to provide the site details.

    Please help me in solving this.


    Thanks, Swaroop Vuppala

    Monday, June 11, 2012 11:05 AM

All replies

  • you want to read value just entered by user? provide callback for onChange for your control and store somewhere entered value. If you mean how to retrieve value just right after plugin started - it is up to you to store it somewhere and retrieve (file, storageitem, etc.)
    Monday, June 11, 2012 11:36 AM
  • Hi DamianD,

    Thanks for your response.

    I want to read the value entered by the user in backstage view. For this I provided the Onchange callback for the edit box and stored in string of seperate class. This is working fine.

    And I have to retrieve this value in Command Bar button click event which is in ThisAddin.cs class, and a Ribbon button click event but it is giving me a null.

    Can you please suggest me in this.


    Thanks, Swaroop Vuppala

    Monday, June 11, 2012 12:05 PM
  • you store value in some class and later it is null? value in this class? it has nothing to do with outlook API, it is more of a question of your programming technique. Show us how you store that value and later how you retrieve it.
    Monday, June 11, 2012 12:20 PM
  • public class CustomProperties
        {
            private string siteUrl;
            public string SiteUrl
            {
                get
                {
                    return siteUrl;
                }
                set
                {
                    siteUrl = value;
                }
            }
    
            private string documentLibrary;
            public string DocumentLibrary
            {
                get
                {
                    return documentLibrary;
                }
                set
                {
                    documentLibrary = value;
                }
            }
            
        }

    i am stroing the value onchange like this in Ribbon.cs

     public void SetValue(Office.IRibbonControl control, string value)
            {
                if (control.Id == "txtSite")
                    properties.SiteUrl = value;
                else if (control.Id == "txtLibrary")
                    properties.DocumentLibrary = value;
            }

    and retieving this value in a Windows form like this.

    public void GetFields() {

    string siteUrl = properties.SiteUrl; }



    Thanks, Swaroop Vuppala

    Monday, June 11, 2012 12:28 PM
  • and where do you store this customproperties object?
    Monday, June 11, 2012 1:04 PM
  • Store the customproperties object ? I didn't get this.

    I have just created this class in Outlook Add-in project and using those properties in Ribbon button events. Can you please tell me how can I can do that ?


    Thanks, Swaroop Vuppala

    Monday, June 11, 2012 3:09 PM
  • not store as in file on disk but where do you store your 'properties' variable so it is accessible in GetFields function
    Monday, June 11, 2012 6:02 PM
  • DaminD,

    May be I am missing this, I have just created the class and using those properties. Can you please tell me how can I do that.


    Thanks, Swaroop Vuppala

    Tuesday, June 12, 2012 5:05 AM
  • you have shown us above function:

    public void GetFields()
    {

       string siteUrl = properties.SiteUrl;
    }

    where do you store properties variable so it is accessible in that function?

    Tuesday, June 12, 2012 7:39 AM