I am trying to modify a Mailitem's category. First, I set
mail.Categories = "";
mail.Save();
Then at some later point, I set the following:
mail.Categories = "Red Category";
mail.Save();
This works most of the time, but sometimes the old category is stale in the messages pane, while the category displayed in the message is correct. If I right-click, only the Red Category is applied as it should. Is there a reason I am experiencing this inconsistency?
Sometimes you need to refresh the view in Outlook by switching to another folder or re-opening an inspector window if you make changes through the Outlook object model.
For explorer windows you may set the CurrentFolder which allows to set a Folder object that represents the current folder displayed in the explorer.
For inspector windows you may close it, release the item shown in the inspector window and then re-open an item by using the EntryID value. See the NameSpace.GetItemFromID method which returns a Microsoft Outlook item identified by the specified entry ID (if valid). Sometimes just re-opening an inspector window helps.
Related
I have an VSTO Outlook Add-in. I have created a custom task pane that is always visible in all the windows at the top, explorer and inspector windows (compose window, etc.). This task pane is always the same, I mean, it has the same title/name, and also it embeds the exactly same user control.
Now I am facing a particular scenario and it is the following: When I open the inspector window (well the compose window), a new custom task pane which is always the same as the one in the explorer window, is added to the top of the compose window. Then when I close compose window I want to remove the custom task pane associated to this inspector (compose window), because otherwise where returning to the explorer window I get more than one custom task panes visible. So I am not able to detect which is the right task pane associated to the inspector opened in order to remove it from Globals.ThisAddIn.CustomTaskPanes using RemoveAt method. The problem I see is that it looks like every task pane added to the Globals.ThisAddIn.CustomTaskPanes collection is indentified through its name and the control that it embeds, but what happens when you have more than one task pane added to that collection with the same name/title and user control? There's no way to uniquely identify each of them.
I have a wrapper for inspector window, so I thought of handle the inspector open and close events and in the open event handler get the index of the custom task pane added to the Globals.ThisAddIn.CustomTaskPanes and then use that index to remove the correponding pane in the inspector close event.
Is this the correct way to do it? or is there any other better way to do it?
I ran into similar confusion while working on a Word addin. Office handles Word & Outlook customtaskpanes differently, so my solution won't map exactly to yours, but I do have a few suggestions:
Check out this section from official MS documentation:
To associate the task pane with a specific Explorer or Inspector, use the CustomTaskPaneCollection.Add method to create the task pane, and pass the Explorer or Inspector object to the window parameter.
I found the method signature you'll need here:
Add(UserControl, String, Object)
Creates a new CustomTaskPane and adds it to the current CustomTaskPaneCollection. The custom task pane is based on the specified UserControl, has the specified title, and is associated with the specified application window.
So to answer your question, MS seems to think this is the "correct" way to do it.
In my opinion, adding a field or property via a wrapper class makes perfect sense too. Especially if you already have it implemented & working properly.
Other suggestions based on my experience wrangling customtaskpanes:
Add an instance field/property to your usercontrol, obviating the need to wrap the customtaskpane class.
Create static class-level lists like List<< customtaskpane >> inspectorPanes in situations where you need to group or track them.
Hope this helps,
I have windows 8 machine and I will give my pc to company owns it. The thing is I dont want anybody able to see my "old" e-mails. I removed from these e-mails in Outlook but:
when I click windows icon left bottom and type somethings related with a deleted mail, it appears in there..(when I try to open it it propt a msg that it is deleted and ask me to remove shortcut too.)
So I want to delete all these fiels completely and not able to see anything about them it musnt be able to search by somehow..
I dont want anything exist about that files in pc
Edited:
I click and view properties of that file appears on windows start bar it located in
"C:/Users/10023213"
so I would think to delete this directory but there is also "AppData" file in it which used by other stuff.. I couldnt figure it out how to remove things about only e mails once for all
Close Outlook.
Go into Control Panel, and in the search box at the top choose Mail (or Mail (32-bit)).
Click the Data Files... button, highlight your name in the list, and then click the Open File Location button, which will open Windows Explorer. Leave Explorer open, but close the Data Files dialog.
Click the Show Profiles... button, where you should see Outlook or your profile name. Select it and click Remove.
Close the Mail control panel dialog. Go back to the Explorer window you left open before, and delete the youremail#yourmailhost.ost file, which is all of your email content (inbox, sent, etc.). You may want to delete all of the other files and folders in this folder, as they're all of your Outlook related info (address book, etc.).
I'm creating a Word Add-in which displays a custom task pane. This pane is then bound to the ribbon to be shown or hidden (simply by changing the visibile property).
After loading a first document, I can see the task pane. However, when I open a new document (which opens a new window), the visible toggle button keeps checking (and thus hiding/showing) the custom task panel associated with the first window.
How do i set the window property on the custom task pane to display it correctly. (Perhaps always show it in all windows?)
Apparantly I was doing it wrong, I expected to have one taskpane shared across all windows, but i needed a taskpane per window. So every document open/new I create one and associate it with the current window.
I know that using .net VSTO there is no way to do this. but what my addin is doing :
When a user clicks on a folder in outlook on the navigation pane, I am showing another folder instead. jus by using the ActiveExpolorer.CurrentFolder = MyNewFolder. the issue here is that outlook will scroll down to the new folder and I want to prevent this.
I can't set back the current folder to the original folder because I am using the FolderSwitch event and so it will be ea endless loop.
I am thinking if I could make it remember the navigation bar position and then set it back to that position when the user click on the folder. using win 32 api ? any ideas ?
or I could reset the current folder to the original folder once the new folder displays it content but then I need to stop outlook displaying the content of the original folder and have no idea how to do this.
Cheers
Meb0134
Ok, I found a way to resolve this issue.
Within the FolderSwitch Event, I create a NivigationFolder on the Favorites Pane for the Folder that I want to show (Instead of the folder the user clicks on) and then select the new NavigationFolder (NavigationFolder.Select = True) and then deselect (NavigationFolder.Select = False) and finally I delete the NavigationFolder from the Favorites pane.
This works perfectly even if the Favorites pane is off.
Mehdi Benkhaldi
I've created an empty Outlook 2007 Plugin Project in Visual Studio 2008 (SP1). Then I added a new Form Region (Contact type, Adjoined, otherwise defaults) and then I run the project.
Outlook opens, I go to a contact change a couple of things, then click on the close button. Outlook asks if I want to save, I choose No.
My understanding is that this should reset all changes I made. But if I re-open that same contact all my changes are still there. If I close the whole outlook it will re-prompt me to save the contact I changed.
This leads me to thinking that the default Form Region template actually keeps a reference to the Contact it is being shown for and not disposing of it after the form region is closed. This causes the contact to be in memory and not simply disposed after closing the form.
Can anyone reproduce, or is it a feature? Any way to get around this?