There is no mechanism in Outlook that will determine if there has been a change to the folder structure on your hard drive in real time. The only possibility is to run an Outlook macro from time to time to examine your folder structure and determine whether there is a task with a subject of the same name in the tasks collection. That part is simple enough. However if there is not such a folder where expected then what information do you want associated with the task subject? The following merely creates a new task with the subject of the project folder name. If you want more information you will have to add-it.
Sub AddProjectToTasks()
Dim oFSO As Object, oSourceFolder As Object, oSubFolder As Object
Dim olNS As NameSpace
Dim olFldr As MAPIFolder
Dim olTask As TaskItem, olNewTask As TaskItem
Dim oCol As New Collection
Dim lngIndex As Long
Dim bFound As Boolean
Const strPath As String = "C:\Users\bruger\Leif Pedersens. Eftf ApS\Team site -General\LPE\2. Tilbudssager\x. Afleverede tilbud\"
Set oFSO = CreateObject("Scripting.FileSystemObject")
If Not oFSO.FileExists(strPath) Then
MsgBox "Følgende mappe er ikke tilgængelig" & vbCr & vbCr & strPath
GoTo lbl_Exit
End If
Set olNS = GetNamespace("MAPI")
Set olFldr = olNS.GetDefaultFolder(olFolderTasks)
For Each olTask In olFldr.Items
If LCase(olTask.Subject) Like "project*" Then
oCol.Add olTask.Subject
End If
Next olTask
Set oSourceFolder = oFSO.GetFolder(strPath)
For Each oSubFolder In oSourceFolder.SubFolders
bFound = False
If LCase(oSubFolder.Name) Like "project*" Then
If oCol.Count > 0 Then
For lngIndex = 1 To oCol.Count
If LCase(oSubFolder.Name) = LCase(oCol(lngIndex)) Then
bFound = True
Exit For
End If
Next lngIndex
End If
If Not bFound Then
Set olNewTask = CreateItem(olTaskItem)
With olNewTask
.Subject = oSubFolder.Name
.Close (olSave)
End With
End If
End If
Next oSubFolder
lbl_Exit:
Set oFSO = Nothing
Set oSourceFolder = Nothing
Set oSubFolder = Nothing
Set olNS = Nothing
Set olFldr = Nothing
Set olTask = Nothing
Set olNewTask = Nothing
Set oCol = Nothing
Exit Sub
End Sub