Google Groups unterstützt keine neuen Usenet-Beiträge oder ‑Abos mehr. Bisherige Inhalte sind weiterhin sichtbar.

Change the MiniIcon in a message

161 Aufrufe
Direkt zur ersten ungelesenen Nachricht

ghis...@nbtconsult.com

ungelesen,
16.03.2008, 12:00:2616.03.08
an
Hello,

I would like to change the MiniIcon of an email.

I use this code but it doesn't change it :

Dim currInspector As Outlook.Inspector =
Globals.ThisAddIn.Application.ActiveInspector
Dim message As Outlook.MailItem =
CType(currInspector.CurrentItem, Outlook.MailItem)
message.FormDescription.Icon = "C:\Program Files\Microsoft
Office\Office12\FORMS\1033\TASKACCL.ICO"
message.FormDescription.MiniIcon = "C:\Program Files\Microsoft
Office\Office12\FORMS\1033\TASKACCS.ICO"

message.FormDescription.PublishForm(Outlook.OlFormRegistry.olDefaultRegistry)
message.Save()

Could you please help me ?

Have a nice day

Regards

Ghislain

Ken Slovak - [MVP - Outlook]

ungelesen,
17.03.2008, 08:44:1217.03.08
an
Does the form have a custom message class?

If you look at an item using the form with a MAPI viewer such as OutlookSpy
(www.dimastr.com) or MFCMAPI do you see a property there PR_ICON_INDEX? If
so does it have a value of -1? You would need to set that if it's not set
to -1 and is there.

That property isn't exposed in the Outlook object model so you'd have to use
a different API such as CDO or Extended MAPI or Redemption if not using
Outlook 2007. For Outlook 2007 you can use the PropertyAccessor object with
a property tag of "http://schemas.microsoft.com/mapi/proptag/0x10800003".

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


<ghis...@nbtconsult.com> wrote in message
news:162a0729-5a02-459f...@s12g2000prg.googlegroups.com...

Ghislain Bruyere

ungelesen,
17.03.2008, 18:22:1417.03.08
an
Thanks for all those informations

Yes I'm using Outlook 2007 but your link http://schemas.microsoft.com/mapi/proptag/0x10800003
doesn't work.

Ghislain

On 17 mar, 13:44, "Ken Slovak - [MVP - Outlook]" <kenslo...@mvps.org>
wrote:


> Does the form have a custom message class?
>
> If you look at an item using the form with a MAPI viewer such as OutlookSpy
> (www.dimastr.com) or MFCMAPI do you see a property there PR_ICON_INDEX? If
> so does it have a value of -1? You would need to set that if it's not set
> to -1 and is there.
>
> That property isn't exposed in the Outlook object model so you'd have to use
> a different API such as CDO or Extended MAPI or Redemption if not using
> Outlook 2007. For Outlook 2007 you can use the PropertyAccessor object with
> a property tag of "http://schemas.microsoft.com/mapi/proptag/0x10800003".
>
> --
> Ken Slovak
> [MVP - Outlook]http://www.slovaktech.com
> Author: Professional Programming Outlook 2007
> Reminder Manager, Extended Reminders, Attachment Optionshttp://www.slovaktech.com/products.htm
>

> <ghisl...@nbtconsult.com> wrote in message


>
> news:162a0729-5a02-459f...@s12g2000prg.googlegroups.com...
>
>
>
> > Hello,
>
> > I would like tochangethe MiniIcon of anemail.
>
> > I use this code but it doesn'tchangeit :
>
> >        Dim currInspector As Outlook.Inspector =
> > Globals.ThisAddIn.Application.ActiveInspector
> >        Dim message As Outlook.MailItem =
> > CType(currInspector.CurrentItem, Outlook.MailItem)

> >        message.FormDescription.Icon= "C:\Program Files\Microsoft


> > Office\Office12\FORMS\1033\TASKACCL.ICO"
> >        message.FormDescription.MiniIcon = "C:\Program Files\Microsoft
> > Office\Office12\FORMS\1033\TASKACCS.ICO"
>

> > message.FormDescription.PublishForm(Outlook.OlFormRegistry.olDefaultRegistr­y)


> >        message.Save()
>
> > Could you please help me ?
>
> > Have a nice day
>
> > Regards
>

> >Ghislain- Masquer le texte des messages précédents -
>
> - Afficher le texte des messages précédents -

Ken Slovak - [MVP - Outlook]

ungelesen,
18.03.2008, 08:59:0118.03.08
an
What do you mean it doesn't work? That's the correct property tag for
PR_ICON_INDEX. That property may not be there, it's not a required property
on an item. If it's not there Outlook automatically uses the default icon
for that item type. If it's there an index value means Outlook is using one
of its standard item icons, if it's set to -1 it uses whatever icons you
specify in the FormDescription.Icon and .MiniIcon properties.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"Ghislain Bruyere" <ghislain...@gmail.com> wrote in message
news:dca1c271-97f2-486e...@h11g2000prf.googlegroups.com...

Dmitry Streblechenko

ungelesen,
18.03.2008, 13:20:2518.03.08
an
That was not a link, but a DASL property name that you need to use when
calling PropertyAccessor.SetProperty

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool

"Ghislain Bruyere" <ghislain...@gmail.com> wrote in message
news:dca1c271-97f2-486e...@h11g2000prf.googlegroups.com...

Ghislain Bruyere

ungelesen,
18.03.2008, 17:21:0118.03.08
an
It works !!!

Thank you very much.

For information, here you are my code

Dim currInspector As Outlook.Inspector =
Globals.ThisAddIn.Application.ActiveInspector
Dim message As Outlook.MailItem = CType(currInspector.CurrentItem,
Outlook.MailItem)

message.PropertyAccessor.SetProperty("http://schemas.microsoft.com/
mapi/proptag/0x10800003", 1)
message.FormDescription.Icon = "C:\Program Files\Microsoft Office


\Office12\FORMS\1033\TASKACCL.ICO"
message.FormDescription.MiniIcon = "C:\Program Files\Microsoft Office
\Office12\FORMS\1033\TASKACCS.ICO"

message.Save()

Ghislain


On Mar 18, 6:20 pm, "Dmitry Streblechenko" <dmi...@dimastr.com> wrote:
> That was not a link, but a DASL property name that you need to use when
> callingPropertyAccessor.SetProperty
>

> Dmitry Streblechenko (MVP)http://www.dimastr.com/


> OutlookSpy  - Outlook, CDO
> and MAPI Developer Tool
>

> "Ghislain Bruyere" <ghislain.bruy...@gmail.com> wrote in message


>
> news:dca1c271-97f2-486e...@h11g2000prf.googlegroups.com...
> Thanks for all those informations
>

> Yes I'm using Outlook 2007 but your linkhttp://schemas.microsoft.com/mapi/proptag/0x10800003

> > - Afficher le texte des messages précédents -- Hide quoted text -
>
> - Show quoted text -

Ken Slovak - [MVP - Outlook]

ungelesen,
19.03.2008, 10:15:2919.03.08
an
Set PR_ICON_INDEX to -1, not 1.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm

"Ghislain Bruyere" <ghislain...@gmail.com> wrote in message

news:eadd0f63-761b-45c3...@i12g2000prf.googlegroups.com...

j

ungelesen,
20.03.2008, 04:25:0020.03.08
an
Hi,

So seems like it's possible to set any icon to MailItem.

Is it possible in VSTO 2005?? For Outlook 2003???

Thanks.

Ken Slovak - [MVP - Outlook]

ungelesen,
20.03.2008, 09:24:1320.03.08
an
VSTO has nothing to do with it. Outlook 2003 doesn't have a
PropertyAccessor() object and provides no access to the PR_ICON_INDEX in the
Outlook object model. Therefore you'd have to access that property using an
alternate API. Since Extended MAPI (C++ and Delphi only) and CDO 1.21 are
both not supported for use with managed code your alternatives are MAPI
wrappers such as Redemption (www.dimastr.com/redemption) or MAPI33 or such.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"j" <Evge...@gmail.com> wrote in message
news:b06128d7-92a4-4109...@n77g2000hse.googlegroups.com...

j

ungelesen,
23.03.2008, 03:56:1823.03.08
an
Thanks for replay.

My AddIn developed on VSTO 2005, C#. Also i'm using Redemption
however didn't find any solution, could you please provide me some
sample regarding this.


Thanks in advance.

Ken Slovak - [MVP - Outlook]

ungelesen,
24.03.2008, 09:30:2224.03.08
an
Well, if you have a MailItem in your code (myMail) to use Redemption with it
would be something like this:

Redemption.SafeMailItem safMail = new Redemption.SafeMailItem();
const int PR_ICON_INDEX = 0x10800003;
safMail.Item = myMail;
int propTag = safMail.GetIdsFromNames
safMail.SetFields(PR_ICON_INDEX, -1);
myMail.Subject = myMail.Subject; // fool Outlook into thinking something has
changed
myMail.Save();

That would set the icon index. That would be the only part where you'd have
to use Redemption code, the rest would be similar to the code Ghislain
posted.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"j" <Evge...@gmail.com> wrote in message

news:1f499a06-4413-4c0c...@u72g2000hsf.googlegroups.com...

j

ungelesen,
25.03.2008, 14:05:2525.03.08
an
Thanks,

I tried your suggestion i wrote the same snippet (except of this line
of code: int propTag = safMail.GetIdsFromNames , i didn't understand
it's reason.)
also i added the Ghislain code, however i doesn't see the Icon.

Any suggestion??

Ken Slovak - [MVP - Outlook]

ungelesen,
25.03.2008, 14:47:5425.03.08
an

The GetIdsFromNames line should have been deleted, I forgot to do that. It's
not needed since PR_ICON_INDEX isn't a MAPI named property but is a standard
property with a property tag value of 0x10800003.

With that code and the other code supplying the icons to use you should see
the icons unless the icon path isn't valid for your system or something else
is wrong. No errors?

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"j" <Evge...@gmail.com> wrote in message

news:bf766a48-1dc7-4bc9...@s13g2000prd.googlegroups.com...

j

ungelesen,
26.03.2008, 04:15:2926.03.08
an
Thanks.

I didn't get any error ( for test reason i provide dummy path for the
icen, and got en exception "File not found" ).

Any ideas??

Thanks in advance.

Ken Slovak - [MVP - Outlook]

ungelesen,
26.03.2008, 09:44:3026.03.08
an
If you got a file not found error then you are providing an incorrect path
or the file doesn't exist.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"j" <Evge...@gmail.com> wrote in message

news:d00c2439-cd7f-483a...@a1g2000hsb.googlegroups.com...

j

ungelesen,
26.03.2008, 09:56:3826.03.08
an
Ken,

Concerning the "File not found" i excplicitly did it, just to chech
wheterer the code is running.
I provide a right path, and don't get any exception however the icon
doesn't chenged.


Any ideas??

Thank you.

Ken Slovak - [MVP - Outlook]

ungelesen,
26.03.2008, 15:21:4426.03.08
an
No, I have no ideas beyond what's already been discussed.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007
Reminder Manager, Extended Reminders, Attachment Options
http://www.slovaktech.com/products.htm


"j" <Evge...@gmail.com> wrote in message

news:8d42891a-7cb1-459e...@i7g2000prf.googlegroups.com...

Sue Mosher [MVP-Outlook]

ungelesen,
27.03.2008, 11:11:5527.03.08
an
Here's what I suspect is happening: Setting any FormDescription properties in an individual item will have no effect, because current versions of Outlook ignore one-off FormDescription information. The solution would be to use a published custom form (or in Outlook 2007, a form region manifest).
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"Ken Slovak - [MVP - Outlook]" <kens...@mvps.org> wrote in message news:%23ak%23bi3jI...@TK2MSFTNGP02.phx.gbl...


> No, I have no ideas beyond what's already been discussed.

>

j

ungelesen,
30.03.2008, 03:29:1830.03.08
an
Thanks Sue,

What do u meanby saying "The solution would be to use a published
custom form ", can explain please, or provide
some sample???
Another question, the AddIn developed for Outlook 2003 on VSTO 2005,
C# 2.0, also the AddIn works fine in Outlook 2007
the " Outlook 2007, a form region manifest", can be used in my
situation??? (I'm using Redemption in my code.)


Thanks in advance.

Sue Mosher [MVP-Outlook]

ungelesen,
30.03.2008, 17:46:0330.03.08
an
Try it for yourself: Create a new message form and on the (Properties) page set the icon. Publish it to your Personal Forms library, ignoring any prompt to check the "Send form definition with item box." Now, change the value of the MessageClass property of any message to the published form's class, e.g. "IPM.Note.MyForm." You should see the message icon change.

Form regions are for Outlook 2007 only.

--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"j" <Evge...@gmail.com> wrote in message news:203ab6d0-5ced-4597...@y21g2000hsf.googlegroups.com...

j

ungelesen,
01.04.2008, 09:16:4001.04.08
an
Sue,

Can i do the same (change icon) on mailItem, without creating a
message form???


Thanks in advance.

Sue Mosher [MVP-Outlook]

ungelesen,
01.04.2008, 11:55:1201.04.08
an
No. As I already explained in my earlier post, you would need to create a published custom form or register a form region, but form regions are for Outlook 2007 only.
--
Sue Mosher, Outlook MVP
Author of Microsoft Outlook 2007 Programming:
Jumpstart for Power Users and Administrators
http://www.outlookcode.com/article.aspx?id=54


"j" <Evge...@gmail.com> wrote in message news:7dada738-8488-4ed2...@i12g2000prf.googlegroups.com...

0 neue Nachrichten