Open, changing then saving a value in a form in a public folder 
Author Message
 Open, changing then saving a value in a form in a public folder

I have tried to take a value from a custom form in a
Public Folder, increment that value by 1 then save it, but
I can't find what method to use:  Save, post, send all fail

Dim oOutlook, oNamespace, oSession, oMsg, oMessages,
oFolder
Dim path, aFolder, i, sID

'path to the Public folder
path = "Public Folders\All Public Folders\Departmental
Information\Information Technology"
'ID of the message to lookup
sID
="000000001A447390AA6611CD9BC800AA002FC45A090018E4F740C025D
31187E00004AC4CD1CE0000006CAA42000018E4F740C025D31187E00004
AC4CD1CE0000006CC4EE0000"

Set oOutlook = CreateObject("Outlook.Application")
Set oNamespace = oOutlook.GetNameSpace("MAPI")

aFolder = Split(path, "\")    'split the path into an
array

Set oFolder = oNamespace.Folders(aFolder(0))    'get the
first folder in the array

For i = 1 To UBound(aFolder)            'loop through the
array, get each folder until we have the last one
        Set oFolder = oFolder.Folders(aFolder(i))
Next

Set oSession = CreateObject("MAPI.Session")
oSession.Logon oNamespace.CurrentUser, "", False, False, 0

Set oMsg = oSession.GetFolder(oFolder.EntryID,
oFolder.StoreID).Messages(sID)  'get the messages in the
folder

'**********************************
'This works as I can read the value in the field
'**********************************
MsgBox  "Type: " & oMsg.Type & vbcrlf & _
        "Title: " & oMsg.Subject & vbcrlf & _
        "Class: " & oMsg.Class & vbcrlf & _
        "Size: " & oMsg.Size & vbcrlf & _
        "Value: " & oMsg.Fields("fdlCount").Value

        'Increase the value field by 1
        oMsg.Fields("fdlCount").Value = Cint(oMsg.Fields
("fdlCount").Value) + 1

'*******************
'This fails
'****************
        'Save changes
        oMsg.Save       'fails as Save, Quit, Close, post,
Send

oSession.Logoff



Tue, 01 Feb 2005 21:43:20 GMT  
 Open, changing then saving a value in a form in a public folder
Update is the correct method for saving a CDO Message.

--
Sue Mosher, Outlook MVP
Outlook and Exchange solutions at http://www.slipstick.com
Author of
     Microsoft Outlook Programming Jumpstart - coming September 2002
     http://www.slipstick.com/books/jumpstart.htm


Quote:
> I have tried to take a value from a custom form in a
> Public Folder, increment that value by 1 then save it, but
> I can't find what method to use:  Save, post, send all fail

> Set oSession = CreateObject("MAPI.Session")
> oSession.Logon oNamespace.CurrentUser, "", False, False, 0

> Set oMsg = oSession.GetFolder(oFolder.EntryID,
> oFolder.StoreID).Messages(sID) 'get the messages in the
> folder

> '**********************************
> 'This works as I can read the value in the field
> '**********************************
> MsgBox "Type: " & oMsg.Type & vbcrlf & _
> "Title: " & oMsg.Subject & vbcrlf & _
> "Class: " & oMsg.Class & vbcrlf & _
> "Size: " & oMsg.Size & vbcrlf & _
> "Value: " & oMsg.Fields("fdlCount").Value

> 'Increase the value field by 1
> oMsg.Fields("fdlCount").Value = Cint(oMsg.Fields
> ("fdlCount").Value) + 1

> '*******************
> 'This fails
> '****************
> 'Save changes
> oMsg.Save 'fails as Save, Quit, Close, post,
> Send

> oSession.Logoff



Tue, 01 Feb 2005 21:57:06 GMT  
 Open, changing then saving a value in a form in a public folder
It works!  Thank you!

Quote:
>-----Original Message-----
>Update is the correct method for saving a CDO Message.

>--
>Sue Mosher, Outlook MVP
>Outlook and Exchange solutions at http://www.slipstick.com
>Author of
>     Microsoft Outlook Programming Jumpstart - coming
September 2002
>     http://www.slipstick.com/books/jumpstart.htm



>> I have tried to take a value from a custom form in a
>> Public Folder, increment that value by 1 then save it,
but
>> I can't find what method to use:  Save, post, send all
fail

>> Set oSession = CreateObject("MAPI.Session")
>> oSession.Logon oNamespace.CurrentUser, "", False,
False, 0

>> Set oMsg = oSession.GetFolder(oFolder.EntryID,
>> oFolder.StoreID).Messages(sID) 'get the messages in the
>> folder

>> '**********************************
>> 'This works as I can read the value in the field
>> '**********************************
>> MsgBox "Type: " & oMsg.Type & vbcrlf & _
>> "Title: " & oMsg.Subject & vbcrlf & _
>> "Class: " & oMsg.Class & vbcrlf & _
>> "Size: " & oMsg.Size & vbcrlf & _
>> "Value: " & oMsg.Fields("fdlCount").Value

>> 'Increase the value field by 1
>> oMsg.Fields("fdlCount").Value = Cint(oMsg.Fields
>> ("fdlCount").Value) + 1

>> '*******************
>> 'This fails
>> '****************
>> 'Save changes
>> oMsg.Save 'fails as Save, Quit, Close, post,
>> Send

>> oSession.Logoff

>.



Sat, 05 Feb 2005 21:27:29 GMT  
 Open, changing then saving a value in a form in a public folder
It works!  Thank you!

Quote:
>-----Original Message-----
>Update is the correct method for saving a CDO Message.

>--
>Sue Mosher, Outlook MVP
>Outlook and Exchange solutions at http://www.slipstick.com
>Author of
>     Microsoft Outlook Programming Jumpstart - coming
September 2002
>     http://www.slipstick.com/books/jumpstart.htm



>> I have tried to take a value from a custom form in a
>> Public Folder, increment that value by 1 then save it,
but
>> I can't find what method to use:  Save, post, send all
fail

>> Set oSession = CreateObject("MAPI.Session")
>> oSession.Logon oNamespace.CurrentUser, "", False,
False, 0

>> Set oMsg = oSession.GetFolder(oFolder.EntryID,
>> oFolder.StoreID).Messages(sID) 'get the messages in the
>> folder

>> '**********************************
>> 'This works as I can read the value in the field
>> '**********************************
>> MsgBox "Type: " & oMsg.Type & vbcrlf & _
>> "Title: " & oMsg.Subject & vbcrlf & _
>> "Class: " & oMsg.Class & vbcrlf & _
>> "Size: " & oMsg.Size & vbcrlf & _
>> "Value: " & oMsg.Fields("fdlCount").Value

>> 'Increase the value field by 1
>> oMsg.Fields("fdlCount").Value = Cint(oMsg.Fields
>> ("fdlCount").Value) + 1

>> '*******************
>> 'This fails
>> '****************
>> 'Save changes
>> oMsg.Save 'fails as Save, Quit, Close, post,
>> Send

>> oSession.Logoff

>.



Sat, 05 Feb 2005 21:27:35 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Saving Custom Task form to a public folder

2. Opening Custom Form in Outlook Public Folder

3. Need help changing value of control on form posted to a specific folder

4. Treeview control changing the picture to open folder/close folder

5. Saving to Public Folders

6. Saving Task to Public folder

7. Need to save a mail item to a public folder when it is sent

8. batch-modifying custom field values in public folder

9. Automating Public Folder Calendar to Save as Web

10. Save Excel spreadsheet to Public Folders???

11. saving contacts to Public folders using CDO

12. How to save sent items in public folder?

 

 
Powered by phpBB® Forum Software