Hi All,
I have the following code snippet to create a folder in the exchange server by checking whether it exists or not.
But I would like to convert this to a workflow instead of using it as a plain VB.Net Code and using Invoke code activity.
Not able to identify proper/matching activity to accommodate the below lines from the code snippets.
**service.AutodiscoverUrl(strAutodiscover)**
**view1.PropertySet.Add(FolderSchema.DisplayName)**
Dim strAutodiscover As String = "emailToBeUsed"
Dim strFolderName As String = "FodlerNameToBeCreated"
Dim strUserName As String = "username"
Dim strPassword As String = "password"
Dim service As ExchangeService = New ExchangeService(ExchangeVersion.Exchange2013_SP1)
service.Credentials = New WebCredentials(strUserName, strPassword)
service.TraceEnabled = True
service.TraceFlags = TraceFlags.All
service.AutodiscoverUrl(strAutodiscover)
Dim view1 As FolderView = New FolderView(100)
view1.PropertySet = New PropertySet(BasePropertySet.IdOnly)
view1.PropertySet.Add(FolderSchema.DisplayName)
view1.Traversal = FolderTraversal.Deep
Dim findFolderResults As FindFoldersResults = service.FindFolders(WellKnownFolderName.Root, view1)
Dim blnFolderExist As Boolean
For Each f As Folder In findFolderResults
If f.DisplayName.Equals(strFolderName, StringComparison.OrdinalIgnoreCase) Then
blnFolderExist = True
End If
Next
If Not blnFolderExist Then
Dim folder As Folder = New Folder(service)
folder.DisplayName = strFolderName
Dim ParentFolder As FolderId = New FolderId(WellKnownFolderName.Inbox, strAutodiscover)
' Create the New folder in the specified destination folder.
folder.Save(ParentFolder)
End If
@Pablito, @loginerror Any help with this?