Is possible to restrict OVC on contacts?

M

Michael Kensy

Hi to all,

I developed a ol-form containing outlooks view control and I would like to
restrict shown items on values of that item. My code is working fine as
long as I restrict on items subject for example but I can't get it working
restriction on items contacts.
My code looks like:
***
Private Sub procUpdateViewControl()
If ...
mstrRestriction = "[Contacts] = '" & myItem.Links.Item(1).Name & "'"
elseif ...
mstrRestriction = "[Subject] = '" & _
myItem.UserProperties("ORDER-ID").Value & "'"
else...
End If

mobjViewControl.Visible = False
With mobjViewControl
.Folder = mstrFolder
.View = mctrlControls5("cboFolderViews").Value
.Restriction = mstrRestriction
End With
mobjViewControl.Visible = True
End Sub
***

So is possible to restrict on [contacts]? And secondly os possible to
restrict ovc on userdefined fields too?
 
S

Sue Mosher [MVP-Outlook]

If you look at the help topic on Items.Restrict, you'll see a list of the fields that cannot be use either in Items.Find or Restrict or in an OVC Restriction. Contacts is one of them, probably because it's not a simple text field.

You should, however, be able to use the Filter property instead of Restriction. It takes the same DASL syntax as you'll see on the SQL tab of the Filter dialog for a folder view. So a good strategy is to create a view that works first.

The basic requirement for filtering or restricting with custom properties is that the properties must be defined in the folder. See http://www.outlookcode.com/d/fields.htm
 
M

Michael Kensy

Hi Sue,


thanx to you ...


Mi, the 06. of Apr in 2005 metioned Sue Mosher [MVP-Outlook]:
If you look at the help topic on Items.Restrict,

ooops sorry ...

you'll see a list of the fields that cannot be use either in Items.Find or Restrict or in an OVC Restriction. Contacts is one of them, probably because it's not a simple text field.
You should, however, be able to use the Filter property instead of Restriction. It takes the same DASL syntax as you'll see on the SQL tab of the Filter dialog for a folder view. So a good strategy is to create a view that works first.
The basic requirement for filtering or restricting with custom properties is that the properties must be defined in the folder. See http://www.outlookcode.com/d/fields.htm


ok, thats a good suggestion
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top