Modifying an Exchange public folder field instead of the custom form field 
Author Message
 Modifying an Exchange public folder field instead of the custom form field

I am writing an application that will notify a number of individuals to act
on a newly submitted custom contact form.  To get around having to resolve
issues with multiple edits at the same time I have written some vbscript
code into the form to lock it until the person currently editting the form
has exited.

The code I have listed below works (with issues), but it forces any person
who opens it when it is not locked to save changes when the form is closed.

What I would like to do is edit the field in the Exchange Public Folder, and
leave Outlook's form mechanisms to deal with detecting edits and saving
changes. How would I go about doing this?

Thanks for your help!

Keith Beers
Systems Administrator
Telocity, Inc.

vbscript code:

function Item_Open()
    DontSave = FALSE
    strOpenedBy = item.userproperties.find("OpenedBy")
    if not item.FileAs="" then
        if strOpenedBy = "" then
            item.userproperties.find("OpenedBy").Value =
application.GetNameSpace("MAPI").CurrentUser
            item.save
        else
            DontSave = TRUE
            msgbox "This request form is currently opened by " & strOpenedBy
&  ". Changes made to this form will not be saved."
        end if
    end if
End Function

Function Item_Close()
    if not item.FileAs="" then
        if DontSave=TRUE then
            msgbox "Data was not saved because form was already opened by "
& strOpenedBy
        else
            item.userproperties.find("OpenedBy").Value = ""
            item.save
        end if
    end if
    item.close 1
end function



Wed, 13 Aug 2003 08:15:00 GMT  
 Modifying an Exchange public folder field instead of the custom form field
You can realize the locking feature using the following code sample. Note
that this is only a sample and not yet finished. You have to check if its
already locked, realize it while closing and s.o.

You have to put this code in the Item_Read procedure because locking isn't
needed while creating a new item.

Sub LockItem()
    dim oSession
    dim oCDOItem

    set oSession = CreateObject("Mapi.Session")
    oSession.Logon,,False,False 'login to the running session
    set oCDOItem = oSession.GetMessage(item.EntryId,Item.Parent.StoreID)
    oCDOItem.fields.Add "OpenedBy", vbString, "Currentuser"
    oCDOItem.Update
End Sub

--
Patrick Jox

office
http://www.lexware.de

home
http://www.joxweb.de (Deutsche Informationen zu Exchange & Outlook)



Quote:
> I am writing an application that will notify a number of individuals to
act
> on a newly submitted custom contact form.  To get around having to resolve
> issues with multiple edits at the same time I have written some vbscript
> code into the form to lock it until the person currently editting the form
> has exited.

> The code I have listed below works (with issues), but it forces any person
> who opens it when it is not locked to save changes when the form is
closed.

> What I would like to do is edit the field in the Exchange Public Folder,
and
> leave Outlook's form mechanisms to deal with detecting edits and saving
> changes. How would I go about doing this?

> Thanks for your help!

> Keith Beers
> Systems Administrator
> Telocity, Inc.

> vbscript code:

> function Item_Open()
>     DontSave = FALSE
>     strOpenedBy = item.userproperties.find("OpenedBy")
>     if not item.FileAs="" then
>         if strOpenedBy = "" then
>             item.userproperties.find("OpenedBy").Value =
> application.GetNameSpace("MAPI").CurrentUser
>             item.save
>         else
>             DontSave = TRUE
>             msgbox "This request form is currently opened by " &
strOpenedBy
> &  ". Changes made to this form will not be saved."
>         end if
>     end if
> End Function

> Function Item_Close()
>     if not item.FileAs="" then
>         if DontSave=TRUE then
>             msgbox "Data was not saved because form was already opened by
"
> & strOpenedBy
>         else
>             item.userproperties.find("OpenedBy").Value = ""
>             item.save
>         end if
>     end if
>     item.close 1
> end function



Wed, 13 Aug 2003 14:51:41 GMT  
 Modifying an Exchange public folder field instead of the custom form field
Thanks Patrick... I will give it a try.
Keith


Quote:
> You can realize the locking feature using the following code sample. Note
> that this is only a sample and not yet finished. You have to check if its
> already locked, realize it while closing and s.o.

> You have to put this code in the Item_Read procedure because locking isn't
> needed while creating a new item.

> Sub LockItem()
>     dim oSession
>     dim oCDOItem

>     set oSession = CreateObject("Mapi.Session")
>     oSession.Logon,,False,False 'login to the running session
>     set oCDOItem = oSession.GetMessage(item.EntryId,Item.Parent.StoreID)
>     oCDOItem.fields.Add "OpenedBy", vbString, "Currentuser"
>     oCDOItem.Update
> End Sub

> --
> Patrick Jox

> office
> http://www.lexware.de

> home
> http://www.joxweb.de (Deutsche Informationen zu Exchange & Outlook)



> > I am writing an application that will notify a number of individuals to
> act
> > on a newly submitted custom contact form.  To get around having to
resolve
> > issues with multiple edits at the same time I have written some vbscript
> > code into the form to lock it until the person currently editting the
form
> > has exited.

> > The code I have listed below works (with issues), but it forces any
person
> > who opens it when it is not locked to save changes when the form is
> closed.

> > What I would like to do is edit the field in the Exchange Public Folder,
> and
> > leave Outlook's form mechanisms to deal with detecting edits and saving
> > changes. How would I go about doing this?

> > Thanks for your help!

> > Keith Beers
> > Systems Administrator
> > Telocity, Inc.

> > vbscript code:

> > function Item_Open()
> >     DontSave = FALSE
> >     strOpenedBy = item.userproperties.find("OpenedBy")
> >     if not item.FileAs="" then
> >         if strOpenedBy = "" then
> >             item.userproperties.find("OpenedBy").Value =
> > application.GetNameSpace("MAPI").CurrentUser
> >             item.save
> >         else
> >             DontSave = TRUE
> >             msgbox "This request form is currently opened by " &
> strOpenedBy
> > &  ". Changes made to this form will not be saved."
> >         end if
> >     end if
> > End Function

> > Function Item_Close()
> >     if not item.FileAs="" then
> >         if DontSave=TRUE then
> >             msgbox "Data was not saved because form was already opened
by
> "
> > & strOpenedBy
> >         else
> >             item.userproperties.find("OpenedBy").Value = ""
> >             item.save
> >         end if
> >     end if
> >     item.close 1
> > end function



Sat, 16 Aug 2003 15:49:28 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. custom fields appear in different form fields for different public folders

2. batch-modifying custom field values in public folder

3. Access 2K attaching to Exchange server/ custom fields in public folders

4. Link to Custom fields in Exchange Public folder

5. Using access custom fields in Exchange public folder missing

6. Outlook 97 custom Form in a Moderated public Exchange folders

7. import info in public folder with custom fields

8. Custom Fields in Public Folders

9. searching for custom fields in different public folders

10. Public Folders: How can internet mail users share public folders on exchange server


 
Powered by phpBB® Forum Software © phpBB Group