Guest
Guest
|
Hi,
I am trying to use the folder that is passed as an arguments in
private void adxOutlookEvents_NamespaceOptionPagesAdd(object sender, object pages, object folder)
I cannot convert it to a MAPIFolder and it is therefore unusable.
Any idea about what I should do?
|
|
Guest
Guest
|
It looks like the function GetFullFolderName has an error because if I remove it in function OptionsPagesAdd of ADXlib, then i can get access to the folder in adxOutlookEvents_NamespaceOptionPagesAdd.
|
|
Sergey Grischenko
Add-in Express team
Posts: 7235
Joined: 2004-07-05
|
Hi.
Thanks for the bug report. I will check it. |
|
Sergey Grischenko
Add-in Express team
Posts: 7235
Joined: 2004-07-05
|
Hi.
Change the GetFullFolderName function as shown below:
internal string GetFullFolderName(object folder)
{
object _folder = null;
object folderObj = null;
IntPtr ifolder = new IntPtr();
string fullName = String.Empty, tmp;
Guid folderGuid = new Guid("00063006-0000-0000-C000-000000000046");
IntPtr unk = Marshal.GetIUnknownForObject(folder);
if (unk == IntPtr.Zero) return String.Empty;
try
{
folderObj = Marshal.GetObjectForIUnknown(unk);
_folder = folderObj;
Marshal.QueryInterface(unk, ref folderGuid, out ifolder);
Marshal.Release(unk);
while(ifolder != IntPtr.Zero)
{
Marshal.Release(ifolder); ifolder = IntPtr.Zero;
tmp = Convert.ToString(folderObj.GetType().InvokeMember("Name", BindingFlags.GetProperty, null, folderObj, null));
fullName = "\\"+tmp+fullName;
try
{
_folder = folderObj.GetType().InvokeMember("Parent", BindingFlags.GetProperty, null, folderObj, null);
}
catch
{
_folder = null;
}
finally
{
Marshal.ReleaseComObject(folderObj);
folderObj = null;
}
if (_folder != null)
{
unk = Marshal.GetIUnknownForObject(_folder);
Marshal.QueryInterface(unk, ref folderGuid, out ifolder);
Marshal.Release(unk);
folderObj = _folder;
}
}
if (fullName != String.Empty && fullName[0] == '\\') fullName = fullName.Remove(0, 1);
}
finally
{
if (folderObj != null)
Marshal.ReleaseComObject(folderObj);
}
return fullName;
}
|
|
Guest
Guest
|
I tried it and it works. Thank you for you prompt reply. |
|
Sergey Grischenko
Add-in Express team
Posts: 7235
Joined: 2004-07-05
|
Hi, Stephane.
Actually we distribute the ADX source code for familiarization purposes. The code is not destined for development your own ADX based applications. I hope that you use our source code to understand .NET development for MS Office only. |
|
Guest
Guest
|
Hi,
Do not worry, I am not working at all in this field. I was trying to understand how I could retrieve the folder selected with a right click on the mouse when displaying the associated property box. That led me to this peace of code.
Regards,
Stéphane |
|