스테 윈 클러 오른쪽입니다 비주얼 스튜디오를 사용할 수 있습니다. 내 추가 기능이 Outlook 2010 및 2013에서 작동 할 수있는 방법을 찾았습니다.
내 추가 기능에는 앞에서 설명한대로 끌어서 놓기 영역과 컨텍스트 메뉴가 있습니다. 나는 outlook.Though의 소스를 가지고 있지는 않지만 2007에서 테스트 할 수있는 리본 메뉴를 만들었습니다.
드래그 앤 드롭 영역에 대해서는 Outlook 2013의 메일을 삭제할 때 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());
}
}
이 선택 객체에서 나는 아웃룩 2010의 양쪽에 노력하고는 MailItem를 얻을 수 있습니다 2013 년.
답장을 보내 주셔서 감사합니다.
Excel 2013이 열렸 기 때문에 Excel AddIn을 설치하는 데 문제가있었습니다. AddIn을 설치하기 전에 모든 Outlook 인스턴스가 닫혔는지 확인 했습니까? – Vache
예 ..Outlook의 모든 인스턴스를 닫았습니다 ... –
추가 기능이 전혀로드되지 않았는지 확인하기 위해 코드에 로깅 문을 추가 할 수 있습니까? Outlook의 추가 기능 목록에서 추가 기능을 찾으면 활성화되어 있습니까? 비활성화 되었습니까? 비활성화 된 경우 그 이유는 무엇입니까? (Outlook 2007에서 Outlook 2013에서 아무런 문제없이 작동하는 추가 기능을 작성했습니다. Outlook 2010과 2013에서는 RibbonMenu를 사용하고 2007 년에는 '정상'메뉴를 사용하고 있습니다.) –