Outlook Banter

Outlook Banter (http://www.outlookbanter.com/)
-   Outlook and VBA (http://www.outlookbanter.com/outlook-vba/)
-   -   move to Outlook Folder (http://www.outlookbanter.com/outlook-vba/9194-move-outlook-folder.html)

Hlewis March 23rd 06 12:50 AM

move to Outlook Folder
 
I have an Access DB that links to a shared mailbox in Outlook (linked to the
Inbox). I have query that logs the receipt times of each email coming into
the mailbox. Please note that I the linked mailbox is not my default Inbox.
This DB is linked to shared mailbox on our server. I want to know if it is
possible to create code that will have MS Access move specific emails to
specific folder within this shared mailbox?
I have already created a form that will allow the user to view each email
separately. They will then select a folder to move the email to from a drop
down menu on this form. I want Access to then move the email to this folder
and out of the Inbox within Outlook. If anyone has any idea how to do this I
would love to hear some of your suggestions.
--
Hlewis

Sue Mosher [MVP-Outlook] March 23rd 06 01:24 AM

move to Outlook Folder
 
Only if you have the entire mailbox visible in your Outlook folder list, in other words, only if the mailbox added as a secondary mailbox through your Exchange account settings.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Hlewis" wrote in message ...
I have an Access DB that links to a shared mailbox in Outlook (linked to the
Inbox). I have query that logs the receipt times of each email coming into
the mailbox. Please note that I the linked mailbox is not my default Inbox.
This DB is linked to shared mailbox on our server. I want to know if it is
possible to create code that will have MS Access move specific emails to
specific folder within this shared mailbox?
I have already created a form that will allow the user to view each email
separately. They will then select a folder to move the email to from a drop
down menu on this form. I want Access to then move the email to this folder
and out of the Inbox within Outlook. If anyone has any idea how to do this I
would love to hear some of your suggestions.
--
Hlewis


Hlewis March 23rd 06 03:48 PM

move to Outlook Folder
 
It is visible in my Outlook folder. What would I do next?
--
Hlewis


"Sue Mosher [MVP-Outlook]" wrote:

Only if you have the entire mailbox visible in your Outlook folder list, in other words, only if the mailbox added as a secondary mailbox through your Exchange account settings.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Hlewis" wrote in message ...
I have an Access DB that links to a shared mailbox in Outlook (linked to the
Inbox). I have query that logs the receipt times of each email coming into
the mailbox. Please note that I the linked mailbox is not my default Inbox.
This DB is linked to shared mailbox on our server. I want to know if it is
possible to create code that will have MS Access move specific emails to
specific folder within this shared mailbox?
I have already created a form that will allow the user to view each email
separately. They will then select a folder to move the email to from a drop
down menu on this form. I want Access to then move the email to this folder
and out of the Inbox within Outlook. If anyone has any idea how to do this I
would love to hear some of your suggestions.
--
Hlewis



Sue Mosher [MVP-Outlook] March 23rd 06 06:11 PM

move to Outlook Folder
 
To use the Move method, you need a MAPIFolder object for the target folder. To get a non-default folder in another mailbox, walk the folder hierarchy using the Folders collections or use a function that does that for you. See http://www.outlookcode.com/d/code/getfolder.htm
--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Hlewis" wrote in message ...
It is visible in my Outlook folder. What would I do next?
--
Hlewis


"Sue Mosher [MVP-Outlook]" wrote:

Only if you have the entire mailbox visible in your Outlook folder list, in other words, only if the mailbox added as a secondary mailbox through your Exchange account settings.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Hlewis" wrote in message ...
I have an Access DB that links to a shared mailbox in Outlook (linked to the
Inbox). I have query that logs the receipt times of each email coming into
the mailbox. Please note that I the linked mailbox is not my default Inbox.
This DB is linked to shared mailbox on our server. I want to know if it is
possible to create code that will have MS Access move specific emails to
specific folder within this shared mailbox?
I have already created a form that will allow the user to view each email
separately. They will then select a folder to move the email to from a drop
down menu on this form. I want Access to then move the email to this folder
and out of the Inbox within Outlook. If anyone has any idea how to do this I
would love to hear some of your suggestions.
--
Hlewis



Hlewis March 24th 06 09:02 AM

move to Outlook Folder
 
Sue,
I looked at this and the path appears to be "Mailbox - TLMS Cost/Inbox".
This mailbox is not in a public folder. It is at the same level as my
default mailbox. So would I use this in the sample code you provided? I'm
sorry if I'm asking silly questions but I am still very new to this. Please
be patient with me. :-)
--
Hlewis


"Sue Mosher [MVP-Outlook]" wrote:

To use the Move method, you need a MAPIFolder object for the target folder. To get a non-default folder in another mailbox, walk the folder hierarchy using the Folders collections or use a function that does that for you. See http://www.outlookcode.com/d/code/getfolder.htm
--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Hlewis" wrote in message ...
It is visible in my Outlook folder. What would I do next?
--
Hlewis


"Sue Mosher [MVP-Outlook]" wrote:

Only if you have the entire mailbox visible in your Outlook folder list, in other words, only if the mailbox added as a secondary mailbox through your Exchange account settings.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Hlewis" wrote in message ...
I have an Access DB that links to a shared mailbox in Outlook (linked to the
Inbox). I have query that logs the receipt times of each email coming into
the mailbox. Please note that I the linked mailbox is not my default Inbox.
This DB is linked to shared mailbox on our server. I want to know if it is
possible to create code that will have MS Access move specific emails to
specific folder within this shared mailbox?
I have already created a form that will allow the user to view each email
separately. They will then select a folder to move the email to from a drop
down menu on this form. I want Access to then move the email to this folder
and out of the Inbox within Outlook. If anyone has any idea how to do this I
would love to hear some of your suggestions.
--
Hlewis



Sue Mosher [MVP-Outlook] March 24th 06 03:07 PM

move to Outlook Folder
 
Yes, the basic technique of walking the folder hierarchy is the same, regardless of where in the hierarchy the folder may be located.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Hlewis" wrote in message ...
Sue,
I looked at this and the path appears to be "Mailbox - TLMS Cost/Inbox".
This mailbox is not in a public folder. It is at the same level as my
default mailbox. So would I use this in the sample code you provided? I'm
sorry if I'm asking silly questions but I am still very new to this. Please
be patient with me. :-)
--
Hlewis


"Sue Mosher [MVP-Outlook]" wrote:

To use the Move method, you need a MAPIFolder object for the target folder. To get a non-default folder in another mailbox, walk the folder hierarchy using the Folders collections or use a function that does that for you. See http://www.outlookcode.com/d/code/getfolder.htm



"Hlewis" wrote in message ...
It is visible in my Outlook folder. What would I do next?
--
Hlewis


"Sue Mosher [MVP-Outlook]" wrote:

Only if you have the entire mailbox visible in your Outlook folder list, in other words, only if the mailbox added as a secondary mailbox through your Exchange account settings.



"Hlewis" wrote in message ...
I have an Access DB that links to a shared mailbox in Outlook (linked to the
Inbox). I have query that logs the receipt times of each email coming into
the mailbox. Please note that I the linked mailbox is not my default Inbox.
This DB is linked to shared mailbox on our server. I want to know if it is
possible to create code that will have MS Access move specific emails to
specific folder within this shared mailbox?
I have already created a form that will allow the user to view each email
separately. They will then select a folder to move the email to from a drop
down menu on this form. I want Access to then move the email to this folder
and out of the Inbox within Outlook. If anyone has any idea how to do this I
would love to hear some of your suggestions.
--
Hlewis



Hlewis March 24th 06 08:10 PM

move to Outlook Folder
 
Okay. Where in the code to I enter the path to the folder?
--
Hlewis


"Sue Mosher [MVP-Outlook]" wrote:

Yes, the basic technique of walking the folder hierarchy is the same, regardless of where in the hierarchy the folder may be located.

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Hlewis" wrote in message ...
Sue,
I looked at this and the path appears to be "Mailbox - TLMS Cost/Inbox".
This mailbox is not in a public folder. It is at the same level as my
default mailbox. So would I use this in the sample code you provided? I'm
sorry if I'm asking silly questions but I am still very new to this. Please
be patient with me. :-)
--
Hlewis


"Sue Mosher [MVP-Outlook]" wrote:

To use the Move method, you need a MAPIFolder object for the target folder. To get a non-default folder in another mailbox, walk the folder hierarchy using the Folders collections or use a function that does that for you. See http://www.outlookcode.com/d/code/getfolder.htm



"Hlewis" wrote in message ...
It is visible in my Outlook folder. What would I do next?
--
Hlewis


"Sue Mosher [MVP-Outlook]" wrote:

Only if you have the entire mailbox visible in your Outlook folder list, in other words, only if the mailbox added as a secondary mailbox through your Exchange account settings.



"Hlewis" wrote in message ...
I have an Access DB that links to a shared mailbox in Outlook (linked to the
Inbox). I have query that logs the receipt times of each email coming into
the mailbox. Please note that I the linked mailbox is not my default Inbox.
This DB is linked to shared mailbox on our server. I want to know if it is
possible to create code that will have MS Access move specific emails to
specific folder within this shared mailbox?
I have already created a form that will allow the user to view each email
separately. They will then select a folder to move the email to from a drop
down menu on this form. I want Access to then move the email to this folder
and out of the Inbox within Outlook. If anyone has any idea how to do this I
would love to hear some of your suggestions.
--
Hlewis




Sue Mosher [MVP-Outlook] March 24th 06 09:45 PM

move to Outlook Folder
 
You enter it before your Move statement:

Set targetFolder = GetFolder("your Outlook folder path")
theItem.Move targetFolder

where GetFolder() is the sample function I mentioned earlier.
--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Hlewis" wrote in message ...
Okay. Where in the code to I enter the path to the folder?
--
Hlewis


"Sue Mosher [MVP-Outlook]" wrote:

Yes, the basic technique of walking the folder hierarchy is the same, regardless of where in the hierarchy the folder may be located.

"Hlewis" wrote in message ...
Sue,
I looked at this and the path appears to be "Mailbox - TLMS Cost/Inbox".
This mailbox is not in a public folder. It is at the same level as my
default mailbox. So would I use this in the sample code you provided? I'm
sorry if I'm asking silly questions but I am still very new to this. Please
be patient with me. :-)
--
Hlewis


"Sue Mosher [MVP-Outlook]" wrote:

To use the Move method, you need a MAPIFolder object for the target folder. To get a non-default folder in another mailbox, walk the folder hierarchy using the Folders collections or use a function that does that for you. See http://www.outlookcode.com/d/code/getfolder.htm



"Hlewis" wrote in message ...
It is visible in my Outlook folder. What would I do next?
--
Hlewis


"Sue Mosher [MVP-Outlook]" wrote:

Only if you have the entire mailbox visible in your Outlook folder list, in other words, only if the mailbox added as a secondary mailbox through your Exchange account settings.



"Hlewis" wrote in message ...
I have an Access DB that links to a shared mailbox in Outlook (linked to the
Inbox). I have query that logs the receipt times of each email coming into
the mailbox. Please note that I the linked mailbox is not my default Inbox.
This DB is linked to shared mailbox on our server. I want to know if it is
possible to create code that will have MS Access move specific emails to
specific folder within this shared mailbox?
I have already created a form that will allow the user to view each email
separately. They will then select a folder to move the email to from a drop
down menu on this form. I want Access to then move the email to this folder
and out of the Inbox within Outlook. If anyone has any idea how to do this I
would love to hear some of your suggestions.
--
Hlewis




Hlewis March 27th 06 01:06 AM

move to Outlook Folder
 
I do not have a Move Statement. I looked at the code via the link you sent
and I don't think I'm following you on this. What I am trying to do is based
on a folder selected from a drop down box on an Access form, have Access move
a message from the "Inbox" to the folder selected.

Please keep in mind that I am new to all of this and really could use a
little more explaination than an experience programmer. I don't mean to be a
pain in your rear end, but you are describing things over my head. Believe
my, it does not take much to do that when it comes to writing code.

I don't know if this will help but this is what I have so far. I have
created a module with the following code:

Public Function GetFolder(strFolderPath As String) As MAPIFolder
' folder path needs to be something like
' "Public Folders\All Public Folders\Company\Sales"
Dim objApp As Outlook.Application
Dim objNS As Outlook.Namespace
Dim colFolders As Outlook.Folders
Dim objFolder As Outlook.MAPIFolder
Dim arrFolders() As String
Dim I As Long
On Error Resume Next
strFolderPath = Replace(strFolderPath, "/", "\")
arrFolders() = Split(strFolderPath, "\")
Set objApp = CreateObject("Outlook.Application")
Set objNS = objApp.GetNamespace("MAPI")
Set objFolder = objNS.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 GetFolder = objFolder
Set colFolders = Nothing
Set objNS = Nothing
Set objApp = Nothing
End Function

Can you briefly tell me what this code is doing. It appears that it is just
calling up the Outlook folder.

If I'm understanding your last response, I need to also have a move command
before this code? This is where I would but the following to specify the
Outlook folder to got to:
Set targetFolder = GetFolder("Mailbox - TLMS Cost")
theItem.Move targetFolder

If so, what would the code look like that would take the results of my
selection from the drop down box? What needs to happen for it to know to
move the email in the form currently visible?
--
Hlewis


"Sue Mosher [MVP-Outlook]" wrote:

You enter it before your Move statement:

Set targetFolder = GetFolder("your Outlook folder path")
theItem.Move targetFolder

where GetFolder() is the sample function I mentioned earlier.
--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Hlewis" wrote in message ...
Okay. Where in the code to I enter the path to the folder?
--
Hlewis


"Sue Mosher [MVP-Outlook]" wrote:

Yes, the basic technique of walking the folder hierarchy is the same, regardless of where in the hierarchy the folder may be located.

"Hlewis" wrote in message ...
Sue,
I looked at this and the path appears to be "Mailbox - TLMS Cost/Inbox".
This mailbox is not in a public folder. It is at the same level as my
default mailbox. So would I use this in the sample code you provided? I'm
sorry if I'm asking silly questions but I am still very new to this. Please
be patient with me. :-)
--
Hlewis


"Sue Mosher [MVP-Outlook]" wrote:

To use the Move method, you need a MAPIFolder object for the target folder. To get a non-default folder in another mailbox, walk the folder hierarchy using the Folders collections or use a function that does that for you. See http://www.outlookcode.com/d/code/getfolder.htm


"Hlewis" wrote in message ...
It is visible in my Outlook folder. What would I do next?
--
Hlewis


"Sue Mosher [MVP-Outlook]" wrote:

Only if you have the entire mailbox visible in your Outlook folder list, in other words, only if the mailbox added as a secondary mailbox through your Exchange account settings.


"Hlewis" wrote in message ...
I have an Access DB that links to a shared mailbox in Outlook (linked to the
Inbox). I have query that logs the receipt times of each email coming into
the mailbox. Please note that I the linked mailbox is not my default Inbox.
This DB is linked to shared mailbox on our server. I want to know if it is
possible to create code that will have MS Access move specific emails to
specific folder within this shared mailbox?
I have already created a form that will allow the user to view each email
separately. They will then select a folder to move the email to from a drop
down menu on this form. I want Access to then move the email to this folder
and out of the Inbox within Outlook. If anyone has any idea how to do this I
would love to hear some of your suggestions.
--
Hlewis





Sue Mosher [MVP-Outlook] March 27th 06 02:39 PM

move to Outlook Folder
 
This is what you said in your original post that you wanted to do:

I want to know if it is possible to create code that will have MS Access move specific emails to specific folder within this shared mailbox?


To accomplish that with Outlook, you use the MailItem.Move method. What GetFolder() does is return the folder that is the target for the Move statement.

If so, what would the code look like that would take the results of my
selection from the drop down box?


Is this the dropdown box you are referring to:

They will then select a folder to move the email to from a drop down menu on this [Access] form.


Your earlier post suggested that this dropdown returns enough information for you to construct a string that provides the full path to the folder? If so, then you will need to use the information from that dropdown to construct the folder path string that the GetFolder() function takes as its argument. GetFolder() can then return that folder as a MAPIFolder object for use with the MailItem.Move method.

What needs to happen for it to know to move the email in the form currently visible?


To move an item, you must have the item as an object and the folder as an object. We've already talked about the folder, so you should be set there. Now we need to talk about the item. Remember that we don't know anything about your form. What information does your Access form provide that might help retrieve the message as a MailItem object? In the Outlook world, the ideal piece of information to have is the value of the EntryID property. If you have that, then you can use the Namespace.GetItemFromID method to return the item:

Set ol = CreateObject("Outlook.Application")
Set ns = ol.GetNamespace("MAPI")
Set theItem = ns.GetItemFromID("the EntryID value")

--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
http://www.turtleflock.com/olconfig/index.htm
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
http://www.outlookcode.com/jumpstart.aspx

"Hlewis" wrote in message ...
I do not have a Move Statement. I looked at the code via the link you sent
and I don't think I'm following you on this. What I am trying to do is based
on a folder selected from a drop down box on an Access form, have Access move
a message from the "Inbox" to the folder selected.

Please keep in mind that I am new to all of this and really could use a
little more explaination than an experience programmer. I don't mean to be a
pain in your rear end, but you are describing things over my head. Believe
my, it does not take much to do that when it comes to writing code.

I don't know if this will help but this is what I have so far. I have
created a module with the following code:

Public Function GetFolder(strFolderPath As String) As MAPIFolder
' folder path needs to be something like
' "Public Folders\All Public Folders\Company\Sales"

snip

Can you briefly tell me what this code is doing. It appears that it is just
calling up the Outlook folder.

If I'm understanding your last response, I need to also have a move command
before this code? This is where I would but the following to specify the
Outlook folder to got to:
Set targetFolder = GetFolder("Mailbox - TLMS Cost")
theItem.Move targetFolder

If so, what would the code look like that would take the results of my
selection from the drop down box? What needs to happen for it to know to
move the email in the form currently visible?
--
Hlewis


"Sue Mosher [MVP-Outlook]" wrote:

You enter it before your Move statement:

Set targetFolder = GetFolder("your Outlook folder path")
theItem.Move targetFolder

where GetFolder() is the sample function I mentioned earlier.

"Hlewis" wrote in message ...
Okay. Where in the code to I enter the path to the folder?
--
Hlewis


"Sue Mosher [MVP-Outlook]" wrote:

Yes, the basic technique of walking the folder hierarchy is the same, regardless of where in the hierarchy the folder may be located.

"Hlewis" wrote in message ...
Sue,
I looked at this and the path appears to be "Mailbox - TLMS Cost/Inbox".
This mailbox is not in a public folder. It is at the same level as my
default mailbox. So would I use this in the sample code you provided?
"Sue Mosher [MVP-Outlook]" wrote:

To use the Move method, you need a MAPIFolder object for the target folder. To get a non-default folder in another mailbox, walk the folder hierarchy using the Folders collections or use a function that does that for you. See http://www.outlookcode.com/d/code/getfolder.htm


"Hlewis" wrote in message ...
It is visible in my Outlook folder. What would I do next?
--
Hlewis


"Sue Mosher [MVP-Outlook]" wrote:

Only if you have the entire mailbox visible in your Outlook folder list, in other words, only if the mailbox added as a secondary mailbox through your Exchange account settings.


"Hlewis" wrote in message ...
I have an Access DB that links to a shared mailbox in Outlook (linked to the
Inbox). I have query that logs the receipt times of each email coming into
the mailbox. Please note that I the linked mailbox is not my default Inbox.
This DB is linked to shared mailbox on our server. I want to know if it is
possible to create code that will have MS Access move specific emails to
specific folder within this shared mailbox?
I have already created a form that will allow the user to view each email
separately. They will then select a folder to move the email to from a drop
down menu on this form. I want Access to then move the email to this folder
and out of the Inbox within Outlook. If anyone has any idea how to do this I
would love to hear some of your suggestions.




All times are GMT +1. The time now is 07:09 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-2006 OutlookBanter.com