PC Review Forums Newsgroups Microsoft Outlook Microsoft Outlook VBA Programming problem with flag icon

Reply

problem with flag icon

 
Thread Tools Rate Thread
Old 21-03-2006, 02:59 PM   #1
None
Guest
 
Posts: n/a
Default problem with flag icon


i'm not very expert on vba script. I'm using outlook 2003 and i'm
trying to do a simple application. Actually I'm receiving an error
using the script below.
The script try to access to the public folder "personale" where there
are a lot of mail.
it display correctly the selected mail (in this case the number 5 since
I wrote "Set mailnow = myfolder.Items(5)") but it can't compute the
last row of the code:

mailnow.FlagIcon = olGreenFlagIcon

giving me the error number 438 - Object doesn't support this property
or method.

Why can't i access to the property flag icon?

thanks for any help

bye!



Sub prova()
Set myfolder = GetPublicFolder("personale")


Set mailnow = myfolder.Items(5)

mailnow.Display

mailnow.FlagIcon = olGreenFlagIcon

End Sub

Public Function GetPublicFolder(strFolderPath)

Dim colFolders
Dim objFolder
Dim arrFolders
Dim i
On Error Resume Next
strFolderPath = Replace(strFolderPath, "/", "\")
arrFolders = Split(strFolderPath, "\")

Set objFolder = Application.GetNamespace("MAPI")
Set objFolder = objFolder.Session.GetDefaultFolder(18)
Set objFolder = objFolder.Folders.Item(arrFolders(0))
If Not objFolder Is Nothing Then
For i = 1 To UBound(arrFolders)
Set colFolders = objFolder.Folders
Set objFolder = Nothing
Set objFolder = colFolders.Item(arrFolders(i))
If objFolder Is Nothing Then
Exit For
End If
Next
End If
Set GetPublicFolder = objFolder
Set colFolders = Nothing
Set objApp = Nothing
Set objFolder = Nothing
End Function

  Reply With Quote
Old 21-03-2006, 05:19 PM   #2
Dmitry Streblechenko
Guest
 
Posts: n/a
Default Re: problem with flag icon

FlagIcon property is only supported by the MailItem and MeetingItem objects.
If you have some other item type in that folder (e.g. PostItem), you will
get that error.
Check first that if the item is of expected type using the Class property -
e.g. it will be olMail (43) for MailItem.

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

"None" <alessandro20@hotmail.com> wrote in message
news:1142953190.706682.17550@i39g2000cwa.googlegroups.com...
> i'm not very expert on vba script. I'm using outlook 2003 and i'm
> trying to do a simple application. Actually I'm receiving an error
> using the script below.
> The script try to access to the public folder "personale" where there
> are a lot of mail.
> it display correctly the selected mail (in this case the number 5 since
> I wrote "Set mailnow = myfolder.Items(5)") but it can't compute the
> last row of the code:
>
> mailnow.FlagIcon = olGreenFlagIcon
>
> giving me the error number 438 - Object doesn't support this property
> or method.
>
> Why can't i access to the property flag icon?
>
> thanks for any help
>
> bye!
>
>
>
> Sub prova()
> Set myfolder = GetPublicFolder("personale")
>
>
> Set mailnow = myfolder.Items(5)
>
> mailnow.Display
>
> mailnow.FlagIcon = olGreenFlagIcon
>
> End Sub
>
> Public Function GetPublicFolder(strFolderPath)
>
> Dim colFolders
> Dim objFolder
> Dim arrFolders
> Dim i
> On Error Resume Next
> strFolderPath = Replace(strFolderPath, "/", "\")
> arrFolders = Split(strFolderPath, "\")
>
> Set objFolder = Application.GetNamespace("MAPI")
> Set objFolder = objFolder.Session.GetDefaultFolder(18)
> Set objFolder = objFolder.Folders.Item(arrFolders(0))
> If Not objFolder Is Nothing Then
> For i = 1 To UBound(arrFolders)
> Set colFolders = objFolder.Folders
> Set objFolder = Nothing
> Set objFolder = colFolders.Item(arrFolders(i))
> If objFolder Is Nothing Then
> Exit For
> End If
> Next
> End If
> Set GetPublicFolder = objFolder
> Set colFolders = Nothing
> Set objApp = Nothing
> Set objFolder = Nothing
> End Function
>



  Reply With Quote
Old 22-03-2006, 08:23 AM   #3
None
Guest
 
Posts: n/a
Default Re: problem with flag icon

Using the class property, I receive the number 45 which should
correspond a olpost.
Is there a way to access to the flagicon properties?
the class postitem does not have this properties but if I can select
the flag icon from outlook for the e-mails in the folder, I think there
will be a way to access to it

thanks

Alex


Dmitry Streblechenko ha scritto:

> FlagIcon property is only supported by the MailItem and MeetingItem objects.
> If you have some other item type in that folder (e.g. PostItem), you will
> get that error.
> Check first that if the item is of expected type using the Class property -
> e.g. it will be olMail (43) for MailItem.
>
> Dmitry Streblechenko (MVP)
> http://www.dimastr.com/
> OutlookSpy - Outlook, CDO
> and MAPI Developer Tool
>
> "None" <alessandro20@hotmail.com> wrote in message
> news:1142953190.706682.17550@i39g2000cwa.googlegroups.com...
> > i'm not very expert on vba script. I'm using outlook 2003 and i'm
> > trying to do a simple application. Actually I'm receiving an error
> > using the script below.
> > The script try to access to the public folder "personale" where there
> > are a lot of mail.
> > it display correctly the selected mail (in this case the number 5 since
> > I wrote "Set mailnow = myfolder.Items(5)") but it can't compute the
> > last row of the code:
> >
> > mailnow.FlagIcon = olGreenFlagIcon
> >
> > giving me the error number 438 - Object doesn't support this property
> > or method.
> >
> > Why can't i access to the property flag icon?
> >
> > thanks for any help
> >
> > bye!
> >
> >
> >
> > Sub prova()
> > Set myfolder = GetPublicFolder("personale")
> >
> >
> > Set mailnow = myfolder.Items(5)
> >
> > mailnow.Display
> >
> > mailnow.FlagIcon = olGreenFlagIcon
> >
> > End Sub
> >
> > Public Function GetPublicFolder(strFolderPath)
> >
> > Dim colFolders
> > Dim objFolder
> > Dim arrFolders
> > Dim i
> > On Error Resume Next
> > strFolderPath = Replace(strFolderPath, "/", "\")
> > arrFolders = Split(strFolderPath, "\")
> >
> > Set objFolder = Application.GetNamespace("MAPI")
> > Set objFolder = objFolder.Session.GetDefaultFolder(18)
> > Set objFolder = objFolder.Folders.Item(arrFolders(0))
> > If Not objFolder Is Nothing Then
> > For i = 1 To UBound(arrFolders)
> > Set colFolders = objFolder.Folders
> > Set objFolder = Nothing
> > Set objFolder = colFolders.Item(arrFolders(i))
> > If objFolder Is Nothing Then
> > Exit For
> > End If
> > Next
> > End If
> > Set GetPublicFolder = objFolder
> > Set colFolders = Nothing
> > Set objApp = Nothing
> > Set objFolder = Nothing
> > End Function
> >


  Reply With Quote
Old 22-03-2006, 06:40 PM   #4
Dmitry Streblechenko
Guest
 
Posts: n/a
Default Re: problem with flag icon

Not using the Outlook Object Model. You will need Extended MAPI/CDO
1.21/Redemption to read the PR_FLAG_ICON (10950003) property.
In Redemption:

set sItem = CreateObject("Redemption.SafeMailItem")
sItem.Item = YourOutlookPostItem
MsgBox sItem.Fields(&H10950003)

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

"None" <alessandro20@hotmail.com> wrote in message
news:1143015790.168171.38890@i39g2000cwa.googlegroups.com...
> Using the class property, I receive the number 45 which should
> correspond a olpost.
> Is there a way to access to the flagicon properties?
> the class postitem does not have this properties but if I can select
> the flag icon from outlook for the e-mails in the folder, I think there
> will be a way to access to it
>
> thanks
>
> Alex
>
>
> Dmitry Streblechenko ha scritto:
>
>> FlagIcon property is only supported by the MailItem and MeetingItem
>> objects.
>> If you have some other item type in that folder (e.g. PostItem), you will
>> get that error.
>> Check first that if the item is of expected type using the Class
>> property -
>> e.g. it will be olMail (43) for MailItem.
>>
>> Dmitry Streblechenko (MVP)
>> http://www.dimastr.com/
>> OutlookSpy - Outlook, CDO
>> and MAPI Developer Tool
>>
>> "None" <alessandro20@hotmail.com> wrote in message
>> news:1142953190.706682.17550@i39g2000cwa.googlegroups.com...
>> > i'm not very expert on vba script. I'm using outlook 2003 and i'm
>> > trying to do a simple application. Actually I'm receiving an error
>> > using the script below.
>> > The script try to access to the public folder "personale" where there
>> > are a lot of mail.
>> > it display correctly the selected mail (in this case the number 5 since
>> > I wrote "Set mailnow = myfolder.Items(5)") but it can't compute the
>> > last row of the code:
>> >
>> > mailnow.FlagIcon = olGreenFlagIcon
>> >
>> > giving me the error number 438 - Object doesn't support this property
>> > or method.
>> >
>> > Why can't i access to the property flag icon?
>> >
>> > thanks for any help
>> >
>> > bye!
>> >
>> >
>> >
>> > Sub prova()
>> > Set myfolder = GetPublicFolder("personale")
>> >
>> >
>> > Set mailnow = myfolder.Items(5)
>> >
>> > mailnow.Display
>> >
>> > mailnow.FlagIcon = olGreenFlagIcon
>> >
>> > End Sub
>> >
>> > Public Function GetPublicFolder(strFolderPath)
>> >
>> > Dim colFolders
>> > Dim objFolder
>> > Dim arrFolders
>> > Dim i
>> > On Error Resume Next
>> > strFolderPath = Replace(strFolderPath, "/", "\")
>> > arrFolders = Split(strFolderPath, "\")
>> >
>> > Set objFolder = Application.GetNamespace("MAPI")
>> > Set objFolder = objFolder.Session.GetDefaultFolder(18)
>> > Set objFolder = objFolder.Folders.Item(arrFolders(0))
>> > If Not objFolder Is Nothing Then
>> > For i = 1 To UBound(arrFolders)
>> > Set colFolders = objFolder.Folders
>> > Set objFolder = Nothing
>> > Set objFolder = colFolders.Item(arrFolders(i))
>> > If objFolder Is Nothing Then
>> > Exit For
>> > End If
>> > Next
>> > End If
>> > Set GetPublicFolder = objFolder
>> > Set colFolders = Nothing
>> > Set objApp = Nothing
>> > Set objFolder = Nothing
>> > End Function
>> >

>



  Reply With Quote
Reply



Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off