Senniger1
asked on
Outlook VBA to Move Task Item to Shared Task Folder
I have Outlook 2010. I have a macro to take my task, make a copy of it and then move the COPY into another task folder. From my mailbox this works perfectly because I'm an administrator so the other mailboxes are not shared mailboxes (see screenshot attachment for My Mailbox).
I now need my users to have this code, but the mailbox "Update CPI" is a Shared Task folder in their mailbox which is what I want(see screenshot attachment for User Mailbox).
Can this line of my code be altered to access a Shared Task Folder?
"Set objFolder = GetFolder("UpdateCPI\Tasks ")"
Here is my entire code:
Thank you in advance!
Screenshot.jpg
I now need my users to have this code, but the mailbox "Update CPI" is a Shared Task folder in their mailbox which is what I want(see screenshot attachment for User Mailbox).
Can this line of my code be altered to access a Shared Task Folder?
"Set objFolder = GetFolder("UpdateCPI\Tasks
Here is my entire code:
Sub CopyTaskDDS()
'Check how many items need to create tasks
' DDS for Docketing
Select Case TypeName(Outlook.Application.ActiveWindow)
Case "Inspector"
CreateTaskfromObject Outlook.Application.ActiveInspector.CurrentItem
Case "Explorer"
Dim objItem As Object
For Each objItem In Outlook.Application.ActiveExplorer.Selection
CreateTaskfromObject objItem
Next
End Select
End Sub
Sub CreateTaskfromObject(objItem As Object)
' NOTE - This code uses CopyTaskDDS
' DDS for Docketing
Dim objTask As Outlook.TaskItem
Select Case objItem.Class
Case olTask
' Duplicate the task (DDS)
Dim objMainTask As TaskItem
Set objTask = Application.CreateItem(olTaskItem)
Set objMainTask = objItem
Set objTask = objMainTask.Copy
With objTask
' .Subject = "DDS of " & .Subject
.Subject = .Subject
.Save
' .Display
End With
End Select
'Close original task
With objMainTask
objItem.Close olSave
End With
' *** DDS MAILBOX ***
' *** Moves selected mail message to the DDS Task folder in the DDS mailbox ***
' NOTE - This code also uses GetFolder Function
Dim obj As Object
Dim i As Long
Dim Sel As Selection
Dim objFolder As Outlook.MAPIFolder
Dim objTasks As Outlook.MAPIFolder
Dim objNS As Outlook.NameSpace
Dim moveTo As Outlook.Folder
Set objNS = Application.GetNamespace("MAPI")
Set objTasks = objNS.GetDefaultFolder(olFolderTasks)
Set objFolder = GetFolder("UpdateCPI\Tasks")
Set Sel = Application.ActiveExplorer.Selection
For i = Sel.Count To 1 Step -1
Set obj = Sel(i)
Select Case True
Case (TypeOf obj Is Outlook.TaskItem), (TypeOf obj Is Outlook.ReportItem)
objTask.Move objFolder
End Select
Next
End Sub
Can anyone assist me. Thank you in advance!
Screenshot.jpg
ASKER
It doesn't work and the rights are fine. I can manually do it. I believe I just need the code to get it to the right path with is Shared Tasks/UpdateCPI
ASKER
I think I need to use the GetSharedDefaultFolder but am not sure exactly how to use it.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
The code I pasted above is the code I used. It makes a copy of the task in my Task folder and moves the copy to the Task folder of an additional mailbox I have opened.
I just don't want to have to add this mailbox to every users mailbox in order for my code to work. It would be better if it is just a Shared folder in which my users have delegated rights.
I just don't want to have to add this mailbox to every users mailbox in order for my code to work. It would be better if it is just a Shared folder in which my users have delegated rights.
Senniger1
did you modify the code as per my post ID: 40810336
it should work.
did you modify the code as per my post ID: 40810336
it should work.
ASKER
Yes I just finished making the modifications. I just wanted to respond promptly to let you know I provided my original working code.
It appears to be working now, but I want to test further.
I'll be in touch.
It appears to be working now, but I want to test further.
I'll be in touch.
Great! Thx for the feedback
Let me know how it goes
Let me know how it goes
ASKER
I've requested that this question be closed as follows:
Accepted answer: 0 points for Senniger1's comment #a40810409
for the following reason:
This was exactly what I needed to make my code work. I really appreciate your help with this!
Accepted answer: 0 points for Senniger1's comment #a40810409
for the following reason:
This was exactly what I needed to make my code work. I really appreciate your help with this!
Senniger1
I think you have accepted your own comment as solution by mistake.
i hereby request Moderator to correct the aceepted answer to ID: 40810336
I think you have accepted your own comment as solution by mistake.
i hereby request Moderator to correct the aceepted answer to ID: 40810336
ASKER
This was exactly what I needed to make my code work. I really appreciate your help with this!
ASKER
Oops, didn't mean to do that. I think I have corrected it now.
Thanks Senniger1
if the shared tasks permission should have the ability to write and edit.