Item Save and Saveas events

Status
Not open for further replies.
A

Ashish

How to differentiate between save and saveas a mail item. Item_Write call

for both cases and parameters for this function doesn't tell any difference

between two.
 
You'd most likely have to grab every single menu/toolbar entry that can

perform those commands and handle their Click events. For Outlook 2007 you'd

have to do the same thing with the ribbon also. This would apply not only to

the actions in Inspectors but also when the item is selected in an Explorer.

"Ashish" <akohli_2004@hotmail.com> wrote in message

news:O%23yhIOHrJHA.588@TK2MSFTNGP03.phx.gbl...
> How to differentiate between save and saveas a mail item. Item_Write call
> for both cases and parameters for this function doesn't tell any
> difference between two.
>
 
I tried to capture the event for menu click but could not make it. Is there

any example available. I tried those which are in outlookcode.com but not

mentioned clearly
<kenslovak@mvps.org> wrote in message

news:OZnPGbIrJHA.1240@TK2MSFTNGP02.phx.gbl...
> You'd most likely have to grab every single menu/toolbar entry that can
> perform those commands and handle their Click events. For Outlook 2007
> you'd have to do the same thing with the ribbon also. This would apply not
> only to the actions in Inspectors but also when the item is selected in an
> Explorer.

> >

>

> "Ashish" <akohli_2004@hotmail.com> wrote in message
> news:O%23yhIOHrJHA.588@TK2MSFTNGP03.phx.gbl...
> > How to differentiate between save and saveas a mail item. Item_Write call
> > for both cases and parameters for this function doesn't tell any
> > difference between two.
> >

>
 
Not a menu click event, but the actual CommandBarButton objects that are

accessed from the menus/toolbars. So you need to instantiate a button

object, declared WithEvents for VB/VBA, representing say File,Save in the

Inspector menus. Then the same for File, SaveAs. And so on for every

possible way to perform those actions. You will need the id properties of

the buttons to grab them. Those can be picked up from a tool like

OutlookSpy.

There are plenty of code samples for using CommandBars.FindControl, which is

what you'd be using. It's up to you to find and grab all relevant

CommandBarButton objects.

"Ashish" <akohli_2004@hotmail.com> wrote in message

news:uxMaMTJrJHA.1212@TK2MSFTNGP04.phx.gbl...
> I tried to capture the event for menu click but could not make it. Is there
> any example available. I tried those which are in outlookcode.com but not
> mentioned clearly
 
Thanks. Yes Now i can capture the SaveAs action.

When we click on SaveAs a new "SaveAs" dislog box appear. How to capture

events for this "SaveAs" dislog box.

Means on saveas dialog there are 2 buttons "Save" and "Cancel". I want to

capture events when i click on these buttons.
<kenslovak@mvps.org> wrote in message

news:O4JAMOKrJHA.3992@TK2MSFTNGP04.phx.gbl...
> Not a menu click event, but the actual CommandBarButton objects that are
> accessed from the menus/toolbars. So you need to instantiate a button
> object, declared WithEvents for VB/VBA, representing say File,Save in the
> Inspector menus. Then the same for File, SaveAs. And so on for every
> possible way to perform those actions. You will need the id properties of
> the buttons to grab them. Those can be picked up from a tool like
> OutlookSpy.

> There are plenty of code samples for using CommandBars.FindControl, which
> is what you'd be using. It's up to you to find and grab all relevant
> CommandBarButton objects.

> >

>

> "Ashish" <akohli_2004@hotmail.com> wrote in message
> news:uxMaMTJrJHA.1212@TK2MSFTNGP04.phx.gbl...
> >I tried to capture the event for menu click but could not make it. Is
> >there any example available. I tried those which are in outlookcode.com
> >but not mentioned clearly

>
 
There are no events you can capture from that dialog.

"Ashish" <akohli_2004@hotmail.com> wrote in message

news:eA%23w6fTrJHA.2484@TK2MSFTNGP03.phx.gbl...
> Thanks. Yes Now i can capture the SaveAs action.
> When we click on SaveAs a new "SaveAs" dislog box appear. How to capture
> events for this "SaveAs" dislog box.
> Means on saveas dialog there are 2 buttons "Save" and "Cancel". I want to
> capture events when i click on these buttons.
 
Oh thats strange. Ok i'll do this task by different way. How to delete a

custom property from mail item.

Suppose i add a new field in mail item on exchange server and i want to

delete this field in outlook addin.

"urn:schemas:mailheader:X-MyField-Name"

IMessagePtr msgptr;

FieldsPtr Flds;

Flds = msgptr->Fields;

Flds->Item[ "urn:schemas:mailheader:X-MyField-Name" ]->Value = "field value"

In outlook addin i can get this field and its value through

HrGetOneProp(PR_TRANSPORT_MESSAGE_HEADERS.)

If i want to delete this field then i think it's possible using HrSetOneProp

> .

But HrSetOneProp takes long value as property tag to set value for any

property. I dont know the long value for

urn:schemas:mailheader:X-MyField-Name. I used outspy/mfcmapi but it doesn't

show that field.
<kenslovak@mvps.org> wrote in message

news:eA7dzqVrJHA.4592@TK2MSFTNGP06.phx.gbl...
> There are no events you can capture from that dialog.

> >

>

> "Ashish" <akohli_2004@hotmail.com> wrote in message
> news:eA%23w6fTrJHA.2484@TK2MSFTNGP03.phx.gbl...
> > Thanks. Yes Now i can capture the SaveAs action.
> > When we click on SaveAs a new "SaveAs" dislog box appear. How to capture
> > events for this "SaveAs" dislog box.
> > Means on saveas dialog there are 2 buttons "Save" and "Cancel". I want to
> > capture events when i click on these buttons.

>
 
Well, for one thing if an email is only within an Exchange organization that

property doesn't exist. Internal emails never have a

PR_TRANSPORT_MESSAGE_HEADERS property.

That property, when it does exist, is a text property (PT_STRING8) and there

are no "subfields" in it. It's just a string. You can parse it using string

functions and find that X-header and remove it using string functions.

"Ashish" <akohli_2004@hotmail.com> wrote in message

news:eOPFtLerJHA.2136@TK2MSFTNGP06.phx.gbl...
> Oh thats strange. Ok i'll do this task by different way. How to delete a
> custom property from mail item.
> Suppose i add a new field in mail item on exchange server and i want to
> delete this field in outlook addin.
> "urn:schemas:mailheader:X-MyField-Name"

> IMessagePtr msgptr;
> FieldsPtr Flds;

> Flds = msgptr->Fields;

> Flds->Item[ "urn:schemas:mailheader:X-MyField-Name" ]->Value = "field
> value"

> In outlook addin i can get this field and its value through
> HrGetOneProp(PR_TRANSPORT_MESSAGE_HEADERS.)

> If i want to delete this field then i think it's possible using
> HrSetOneProp .

> But HrSetOneProp takes long value as property tag to set value for any
> property. I dont know the long value for
> urn:schemas:mailheader:X-MyField-Name. I used outspy/mfcmapi but it
> doesn't show that field.
 
Yes i did same. I get value for PR_TRANSPORT_MESSAGE_HEADERS and search

x_header when open item. Then get the value for x_header and remove it. It

works successfully. But when i close item i get value for

PR_TRANSPORT_MESSAGE_HEADERS and set the value of x_header which i

delete.This i do because when i open mail next time x_header should be

there. But this time the value is not set. I tried to set it in

item_close/inspector_deactivate event but value is not set. While if i debug

the program step by step the value is set. Please suggest from where i

should set it when close the item.
<kenslovak@mvps.org> wrote in message

news:eg7PTThrJHA.6020@TK2MSFTNGP02.phx.gbl...
> Well, for one thing if an email is only within an Exchange organization
> that property doesn't exist. Internal emails never have a
> PR_TRANSPORT_MESSAGE_HEADERS property.

> That property, when it does exist, is a text property (PT_STRING8) and
> there are no "subfields" in it. It's just a string. You can parse it using
> string functions and find that X-header and remove it using string
> functions.

> >

>

> "Ashish" <akohli_2004@hotmail.com> wrote in message
> news:eOPFtLerJHA.2136@TK2MSFTNGP06.phx.gbl...
> > Oh thats strange. Ok i'll do this task by different way. How to delete a
> > custom property from mail item.
> > Suppose i add a new field in mail item on exchange server and i want to
> > delete this field in outlook addin.
> > "urn:schemas:mailheader:X-MyField-Name"
>

>> IMessagePtr msgptr;
> > FieldsPtr Flds;
>

>> Flds = msgptr->Fields;
>

>> Flds->Item[ "urn:schemas:mailheader:X-MyField-Name" ]->Value = "field
> > value"
>

>> In outlook addin i can get this field and its value through
> > HrGetOneProp(PR_TRANSPORT_MESSAGE_HEADERS.)
>

>> If i want to delete this field then i think it's possible using
> > HrSetOneProp .
>

>> But HrSetOneProp takes long value as property tag to set value for any
> > property. I dont know the long value for
> > urn:schemas:mailheader:X-MyField-Name. I used outspy/mfcmapi but it
> > doesn't show that field.

>
 
MAPI properties with a specific GUID are transformed into x-headers when the

item gets sent out, transformed by the message transport from a property

into part of the header. That's the only time that happens. You can grab and

existing PR_TRANSPORT_MESSAGE_HEADERS string and manipulate it using string

functions to add something and write it back. That's about it.

Why not just create an Outlook UserProperty, or if you don't want it to be

available to users create a named MAPI property and use that?

"Ashish" <akohli_2004@hotmail.com> wrote in message

news:OiYZUbhrJHA.528@TK2MSFTNGP06.phx.gbl...
> Yes i did same. I get value for PR_TRANSPORT_MESSAGE_HEADERS and search
> x_header when open item. Then get the value for x_header and remove it. It
> works successfully. But when i close item i get value for
> PR_TRANSPORT_MESSAGE_HEADERS and set the value of x_header which i
> delete.This i do because when i open mail next time x_header should be
> there. But this time the value is not set. I tried to set it in
> item_close/inspector_deactivate event but value is not set. While if i
> debug the program step by step the value is set. Please suggest from where
> i should set it when close the item.
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
C Change default "Save Sent Item To" folder Outlook VBA and Custom Forms 9
D Save Sent Item to Using Outlook 0
JohnP Shared Mailboxes "Save Sent Item" Using Outlook 2
R How do I 'Save Copy of Sent Item to Folder' for a Shared Mailbox Outlook VBA and Custom Forms 9
T Exchange 2010: 'could not save item' and 'Unknown error' when edit calendars Exchange Server Administration 1
T PR_MESSAGE_CLASS is reset when calling Save() on item Outlook VBA and Custom Forms 4
T Outlook365 search item listed as "potential matches" can't be opened Using Outlook 0
H Outlook 365 O365 outlook calendar item editing Using Outlook 1
P "Item could not be moved" message occurs frequently for IMAP inbox, Office 365 Using Outlook 0
V How to add 'Previous Item' and 'Next Item' to the Quick Access Toolbar Using Outlook 1
O In Agenda-view - How to copy an existing item months ahead or back? Using Outlook 0
S Outlook 2016 dont delete inbox item Using Outlook 0
talla Can't open Outlook Item. Using Outlook 0
N Item cannot be saved because it was modified by another user or window, and, Item could not be moved... Using Outlook 0
B Zoom automatically next email item (VBA) Outlook VBA and Custom Forms 2
S Command Button_Click action on Item/Reminder Outlook VBA and Custom Forms 3
A Unflag Inbox and Flag Inbox with Orange Category After Item is send Outlook VBA and Custom Forms 3
A Run-time error '430' on certain emails when trying to set "Outlook.mailitem" as "ActiveExplorer.Selection.Item" Outlook VBA and Custom Forms 2
C Copy Move item won't work Outlook VBA and Custom Forms 2
T Pictures degrade each time an Outlook item is edited and re-saved Using Outlook 1
B Change row background color of selected item Using Outlook 1
P Outlook 2013 "Item could not be moved - still an issue for Outlook 2013 Using Outlook 0
R Error when trying to forward current email item Outlook VBA and Custom Forms 7
geoffnoakes Find Contacts with UDFs "in this item" Using Outlook 1
T "cannot find the calendar folder for this item" - calendar items stuck in outbox Using Outlook 0
GregS Many Sent Item folders Using Outlook 3
B Select / activate first email item in the searched query Using Outlook 1
4 Macro to set the category of Deleted Item? Outlook VBA and Custom Forms 2
N "Discussion" item Using Outlook 3
T outlook.com opens with "item not found" Using Outlook 1
Peter H Williams How to Move Mail item after processing Outlook VBA and Custom Forms 5
M Shortcut to another outlook item Using Outlook 0
M Item edits doesn't always sync Using Outlook 11
Cdub27 Your changes to this item couldn't be saved because Server Denied Operation (HTTP 403 Forbidden) Using Outlook 1
M VBA to change flag status in outlook contact item Outlook VBA and Custom Forms 3
P Replying to calendar item using VBA Outlook VBA and Custom Forms 4
G Outlook item link Using Outlook 0
Q VBA Script to move item in secondary mailbox Outlook VBA and Custom Forms 2
T outlook 2010 mail item count doesnt match display Outlook VBA and Custom Forms 3
Jeanne Goodman Delete Calendar Item Bypassing Deleted Items folder Outlook VBA and Custom Forms 2
Diane Poremsky Display the Created Date field of any Outlook item Using Outlook 0
Diane Poremsky Outlook VBA: Work with Open Item or Selected Item Using Outlook 0
Z Item.Recipients for Task Assignment on Send Outlook VBA and Custom Forms 10
M How does Outlook determine item numbers in a folder? Outlook VBA and Custom Forms 3
J "This item has been changed still want to delete it" message Using Outlook 3
oliv- HIDE ITEM Outlook VBA and Custom Forms 3
D help with Item/Inspector close event Outlook VBA and Custom Forms 1
T Create new item in public folder using VBscript Outlook VBA and Custom Forms 1
D Shared Mailbox with mail item marked as "private" Using Outlook 0
Diane Poremsky Change Item Count on All Folders in a Data File Using Outlook 0

Similar threads

Back
Top