Outlook 2010 does not work in promising 2013

I created Outlook 2010 addinin visual studio 2012. They have a context menu and a drag area.

I created an installer file. when I installed it on a PC that outlook 2013it didn’t work for.

How can I create a version independent of the version of Outlook in which I can work with each version of Outlook.?

Any help for this would be appreciated ...!

+4
source share
3 answers

Steffen Winkler is right. I found a way in which my application can work in Outlook 2010 and 2013.

, . , . outlook 2007. .

, , Outlook 2010, , Outlook 2010. , , Int64, .

:

private void DragNDropArea_DragDrop(object sender, DragEventArgs e)
{
     //wrap standard IDataObject in OutlookDataObject
     OutlookDataObject dataObject = new OutlookDataObject(e.Data);

     //get the names and data streams of the files dropped
     string[] filenames = (string[])dataObject.GetData("FileGroupDescriptorW");
     MemoryStream[] filestreams = (MemoryStream[])dataObject.GetData("FileContents");

     for (int fileIndex = 0; fileIndex < filenames.Length; fileIndex++)
     {
         try
         {
             //use the fileindex to get the name and data stream
             string filename = filenames[fileIndex];
             MemoryStream filestream = filestreams[fileIndex];



             string startupPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal);   

             if (Directory.Exists(startupPath))
             { }
             else
             {
                  Directory.CreateDirectory(startupPath);
             }

             //save the file stream using its name to the application path
             FileStream outputStream = File.Create(startupPath + "\\" + filename + ".msg");

             filestream.Seek(0, SeekOrigin.Begin);
             filestream.WriteTo(outputStream);

             outputStream.Close();
             filestream.Close();
             readMessage(filename, startupPath);
       }
       catch (System.Exception ex)
       {
            MessageBox.Show("Error Occured In getting Mail info..: \n" + ex.ToString());
       }
   }
}

OutlookDataObject.cs GetData() :

//create a new array to store file names in of the number of items in the file group descriptor
string[] fileNames = new string[fileGroupDescriptor.cItems];

//get the pointer to the first file descriptor
IntPtr fileDescriptorPointer = (IntPtr)((Int64)fileGroupDescriptorAPointer + Marshal.SizeOf(fileGroupDescriptorAPointer));
//loop for the number of files acording to the file group descriptor
for (int fileDescriptorIndex = 0; fileDescriptorIndex < fileGroupDescriptor.cItems; fileDescriptorIndex++)
{
    //marshal the pointer top the file descriptor as a FILEDESCRIPTORA struct and get the file name
    NativeMethods.FILEDESCRIPTORA fileDescriptor = (NativeMethods.FILEDESCRIPTORA)Marshal.PtrToStructure(fileDescriptorPointer, typeof(NativeMethods.FILEDESCRIPTORA));
    fileNames[fileDescriptorIndex] = fileDescriptor.cFileName;

    //move the file descriptor pointer to the next file descriptor
    fileDescriptorPointer = (IntPtr)((Int64)fileDescriptorPointer + Marshal.SizeOf(fileDescriptor));
 }

" ". :
Ribbon1.xml:

<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui" onLoad="Ribbon_Load" loadImage="GetImage">
  <contextMenus>
    <contextMenu idMso="ContextMenuMailItem">
      <button id="MyContextMenuMailItem" 
          label="OnePgr Integrator"
          onAction="OnMyButtonClick" showImage="true" image="favicon.ico.ico"/>
    </contextMenu>
    <contextMenu idMso="ContextMenuMultipleItems">
      <button id="MyContextMenuMultipleItems"
          label="OnePgr Integrator" image="favicon.ico.ico"
          onAction="OnMyButtonClick"/>
    </contextMenu>
  </contextMenus>
</customUI>

Ribbon1.cs:

public void OnMyButtonClick(Office.IRibbonControl control)
{
     try
     {
          Outlook.Selection selectedMails = control.Context as Outlook.Selection;
     }
     catch (System.Exception ex)
     {
          MessageBox.Show(ex.ToString());
     }
}

MailItem, Outlook 2010, 2013 .

...!

0

Office/Outlook 2013 Click-to-Run (C2R) MSI. MSI 2010 .

C2R .

0

Microsoft,

Outlook 2010 .., Visual Studio 2010 Visual Studio 2012.

Outlook 2013 .., Visual Studio 2013.

http://msdn.microsoft.com/en-us/office/hh133430.aspx

0
source

All Articles