A Microsoft Outlook email forum. Outlook Banter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Outlook Banter forum » Microsoft Outlook Email Newsgroups » Add-ins for Outlook
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Problem with UserPorperties in eMails



 
 
Thread Tools Search this Thread Display Modes
  #1  
Old August 7th 06, 01:51 PM posted to microsoft.public.outlook.program_addins
franz
external usenet poster
 
Posts: 3
Default Problem with UserPorperties in eMails

Hello,

My Add-In adds a new Property to eMails. I use the typelibraries for
Outlook2000.
The Add in is developed in Delphi.

The userdefined field 'Printed' will set in the Inspector but not in the
INBOX-Folder.

In Inspector:

var AMailItem: MailItem;
AUserProperty: UserProperty;

AMailItem := FOutlookApp.ActiveInspector.CurrentItem as MailItem;
AProp := AMailItem.UserProperties.Find('Printed', EmptyParam);
if AProp = Nil then begin
AProp := AMailItem.UserProperties.Add('Printed', olText, True, EmptyParam);
AProp.Value := 'YES';
end
else begin
AProp.Value := 'YES';
end;
AMailItem.Save;

In the Inspector it works correct

In Folder (InBox):

AMailItem := FOutlookApp.ActiveExplorer.Selection.Item(1) as MailItem;
AProp := AMailItem.UserProperties.Find('Printed', EmptyParam);
if AProp = Nil then begin
AProp := AMailItem.UserProperties.Add('Printed', olText, True, EmptyParam);
AProp.Value := 'YES';
end
else begin
AProp.Value := 'YES';
end;
AMailItem.Save;

In the INBOX-Folder it not works. No Error - but the Field will not displayed.

Can someone help me?
franz


  #2  
Old August 7th 06, 10:54 PM posted to microsoft.public.outlook.program_addins
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default Problem with UserPorperties in eMails

Did you actually step through your code? If UserProperties.Find cannot find
a property, it raises an error (DISP_E_UNKNOWNNAME), but you never trap it.

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

"franz" wrote in message
...
Hello,

My Add-In adds a new Property to eMails. I use the typelibraries for
Outlook2000.
The Add in is developed in Delphi.

The userdefined field 'Printed' will set in the Inspector but not in the
INBOX-Folder.

In Inspector:

var AMailItem: MailItem;
AUserProperty: UserProperty;

AMailItem := FOutlookApp.ActiveInspector.CurrentItem as MailItem;
AProp := AMailItem.UserProperties.Find('Printed', EmptyParam);
if AProp = Nil then begin
AProp := AMailItem.UserProperties.Add('Printed', olText, True,
EmptyParam);
AProp.Value := 'YES';
end
else begin
AProp.Value := 'YES';
end;
AMailItem.Save;

In the Inspector it works correct

In Folder (InBox):

AMailItem := FOutlookApp.ActiveExplorer.Selection.Item(1) as MailItem;
AProp := AMailItem.UserProperties.Find('Printed', EmptyParam);
if AProp = Nil then begin
AProp := AMailItem.UserProperties.Add('Printed', olText, True,
EmptyParam);
AProp.Value := 'YES';
end
else begin
AProp.Value := 'YES';
end;
AMailItem.Save;

In the INBOX-Folder it not works. No Error - but the Field will not
displayed.

Can someone help me?
franz




  #3  
Old August 8th 06, 11:26 AM posted to microsoft.public.outlook.program_addins
franz
external usenet poster
 
Posts: 3
Default Problem with UserPorperties in eMails

Hi Dmitry

I tested it. That is not the problem.

When i cannot find the property, i add it to the 'AmailItem'.
After adding the property i can find it, but the property will not saved and
i cannot see it in the Folder.

I hope this helps you. Franz



"Dmitry Streblechenko" wrote:

Did you actually step through your code? If UserProperties.Find cannot find
a property, it raises an error (DISP_E_UNKNOWNNAME), but you never trap it.

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

"franz" wrote in message
...
Hello,

My Add-In adds a new Property to eMails. I use the typelibraries for
Outlook2000.
The Add in is developed in Delphi.

The userdefined field 'Printed' will set in the Inspector but not in the
INBOX-Folder.

In Inspector:

var AMailItem: MailItem;
AUserProperty: UserProperty;

AMailItem := FOutlookApp.ActiveInspector.CurrentItem as MailItem;
AProp := AMailItem.UserProperties.Find('Printed', EmptyParam);
if AProp = Nil then begin
AProp := AMailItem.UserProperties.Add('Printed', olText, True,
EmptyParam);
AProp.Value := 'YES';
end
else begin
AProp.Value := 'YES';
end;
AMailItem.Save;

In the Inspector it works correct

In Folder (InBox):

AMailItem := FOutlookApp.ActiveExplorer.Selection.Item(1) as MailItem;
AProp := AMailItem.UserProperties.Find('Printed', EmptyParam);
if AProp = Nil then begin
AProp := AMailItem.UserProperties.Add('Printed', olText, True,
EmptyParam);
AProp.Value := 'YES';
end
else begin
AProp.Value := 'YES';
end;
AMailItem.Save;

In the INBOX-Folder it not works. No Error - but the Field will not
displayed.

Can someone help me?
franz





  #4  
Old August 8th 06, 08:08 PM posted to microsoft.public.outlook.program_addins
Dmitry Streblechenko
external usenet poster
 
Posts: 2,116
Default Problem with UserPorperties in eMails

I had no problem running the following VB script. Does it work for you?

set Msg = Application.ActiveExplorer.Selection.Item(1)
on error resume next
err.Clear
set prop = msg.Userproperties.Find("Printed")
if (prop is Nothing) or (err.Number 0) Then
set prop = msg.UserProperties.Add("Printed", olText, true)
End If
prop.Value = "YES"
msg.Save

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

"franz" wrote in message
news
Hi Dmitry

I tested it. That is not the problem.

When i cannot find the property, i add it to the 'AmailItem'.
After adding the property i can find it, but the property will not saved
and
i cannot see it in the Folder.

I hope this helps you. Franz



"Dmitry Streblechenko" wrote:

Did you actually step through your code? If UserProperties.Find cannot
find
a property, it raises an error (DISP_E_UNKNOWNNAME), but you never trap
it.

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

"franz" wrote in message
...
Hello,

My Add-In adds a new Property to eMails. I use the typelibraries for
Outlook2000.
The Add in is developed in Delphi.

The userdefined field 'Printed' will set in the Inspector but not in
the
INBOX-Folder.

In Inspector:

var AMailItem: MailItem;
AUserProperty: UserProperty;

AMailItem := FOutlookApp.ActiveInspector.CurrentItem as MailItem;
AProp := AMailItem.UserProperties.Find('Printed', EmptyParam);
if AProp = Nil then begin
AProp := AMailItem.UserProperties.Add('Printed', olText, True,
EmptyParam);
AProp.Value := 'YES';
end
else begin
AProp.Value := 'YES';
end;
AMailItem.Save;

In the Inspector it works correct

In Folder (InBox):

AMailItem := FOutlookApp.ActiveExplorer.Selection.Item(1) as MailItem;
AProp := AMailItem.UserProperties.Find('Printed', EmptyParam);
if AProp = Nil then begin
AProp := AMailItem.UserProperties.Add('Printed', olText, True,
EmptyParam);
AProp.Value := 'YES';
end
else begin
AProp.Value := 'YES';
end;
AMailItem.Save;

In the INBOX-Folder it not works. No Error - but the Field will not
displayed.

Can someone help me?
franz







 




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
problem with outlook receiving same emails two times [email protected] Outlook - General Queries 2 June 1st 06 07:25 PM
problem with cut emails in greek John Jay Smith Outlook Express 3 April 9th 06 05:03 PM
Problem replying to emails... Mark (MSA) Outlook - General Queries 5 March 15th 06 10:20 PM
Outlook emails problem chesjak Outlook - Installation 1 March 15th 06 10:00 AM
Moving Emails to Folders - Problem [email protected] Outlook - General Queries 1 February 21st 06 04:40 PM


All times are GMT +1. The time now is 09:28 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2025 Outlook Banter.
The comments are property of their posters.