adxOutlookEvents_NamespaceOptionPagesAdd +Folder

Add-in Express™ Support Service
That's what is more important than anything else

adxOutlookEvents_NamespaceOptionPagesAdd +Folder
 
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?
Posted 13 Oct, 2005 04:41:45 Top
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.
Posted 13 Oct, 2005 05:39:16 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
Joined: 2004-07-05
Hi.

Thanks for the bug report. I will check it.
Posted 13 Oct, 2005 06:15:18 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
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;
}
Posted 13 Oct, 2005 06:59:10 Top
Guest


Guest


I tried it and it works. Thank you for you prompt reply.
Posted 13 Oct, 2005 08:17:00 Top
Sergey Grischenko


Add-in Express team


Posts: 7233
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.
Posted 14 Oct, 2005 06:04:56 Top
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
Posted 25 Oct, 2005 09:38:05 Top