I have been attempting this all morning (VS2K10, OL2K7, .NET 3.5) and my PSTs never attach. I've modified the path to include escaped slashes, no dice. I occasionally see the PST get added then disappear when I hit the command bar button for which I am trying to program.
Here is a snip of my code:
void b_removedPSTs_Click(Office.CommandBarButton Ctrl, ref bool CancelDefault)
{
string PSTToAdd = dd_removed_PSTs.Text;
foreach (PSTWithPath p in removedPSTs)
{
if (PSTToAdd == p.name)
{
olApp.Session.AddStore(@p.path);
}
}
UpdateRemovedList();
}
PSTWithPath is a custom class I've created as follows:
public class PSTWithPath { public string name; public string path; public Outlook.MAPIFolder mapifolder;
public PSTWithPath(string PSTName, string PSTPath, Outlook.MAPIFolder PSTMAPIFolder)
{
name = PSTName;
path = PSTPath;
mapifolder = PSTMAPIFolder;
}
Advice would be greatly appreciated.
Thanks, Larry