Quantcast
Channel: Exchange Server Development forum
Viewing all articles
Browse latest Browse all 7132

Getting AccountIsLockedException

$
0
0

To All:

I have a VB.Net  app that I am expanding from searching the local Outlook Inbox (for emails within a date-range and from/to specific email addresses…which after several starts and stops…is working fine with Outlook) to a Server Folder via ExchangeService (for messages older than 30 days…which I really need to access).

I have setup my test program to access it, but I’m receiving an AccountIsLockedException: This account is locked. Visit http://technet.microsoft.com/en-us/library/dn270518.aspx#howapppassword to unlock it.

I thought that I just had to treat this like other OAuth code that I previously used to access other non-MS accounts: Google, Dropbox, SoundCloud, etc. where I opened up a WebBrowser control with an OAuth Url and waited until I received the correct response and then stored the token returned in WebBrowser.Document to use later in the code.

Apparently…this isn’t the case, or it is…and I’m missing the point.

Here is the code that I’m working on:

Dim myExchangeService As New ExchangeService
Dim strURL As String = mpnNamespace.ExchangeMailboxServerName
myExchangeService.Credentials = New WebCredentials("<EMailAddress>", "<Password>")
myExchangeService.UseDefaultCredentials = False
myExchangeService.Url = New Uri(strURL)
Try
	myExchangeService.AutodiscoverUrl(mpnNamespace.Accounts(1).DisplayName, AddressOf fncRedirectionCallback)
Catch ex As AccountIsLockedException 			
	Debug.Print("AccountIsLockedException: " & ex.AccountUnlockUrl.ToString)
	Form2.SetRedirectionCallbackUrl = ex.AccountUnlockUrl.ToString
	Form2.ShowDialog()
	Form2.Dispose()
End Try

where Form2 contains the WebBrowser control.

Even though I’m able to logon to my account within the WebBrowser of Form2 (and use my cellphone for Microsoft Verification)…I don’t have a clue as to how to grant access to my vb.net app while it’s executing.

It does send: https://webshell.suite.office.com/iframe/TokenFactoryIframe?origin= &shsid= &apiver=oneshell&cshver=20200525.1

But I’m not sure what these tokens are and if they’re somehow supposed to be included in the next part of the process.

It also accesses:
https://webdir.online.lync.com/xframe
https://webdir1b.online.lync.com/Autodiscover/XFrame/XFrame.html#

https://webdir3a.online.lync.com/Autodiscover/AutodiscoverService.svc/root/xframe
https://webdir3a.online.lync.com/Autodiscover/XFrame/XFrame.html#
https://webdir3a.online.lync.com/Autodiscover/XFrame/XFrame.html#
https://webpoolsn23a13.infra.lync.com/Autodiscover/XFrame/XFrame.html#


After the form closes, it proceeds to the next stage, which is to build the Search Parameters (this comes from a well known example from MS):

Dim allFoldersType As ExtendedPropertyDefinition = New ExtendedPropertyDefinition(13825, MapiPropertyType.Integer)
Dim rootFolderId As FolderId = New FolderId(WellKnownFolderName.Root)
Dim folderView As FolderView = New FolderView(1000)
		folderView.Traversal = FolderTraversal.Shallow

Dim searchFilter1 As SearchFilter = New SearchFilter.IsEqualTo(allFoldersType, "2")
Dim searchFilter2 As SearchFilter = New SearchFilter.IsEqualTo(FolderSchema.DisplayName, "allitems")

Dim searchFilterCollection1 As SearchFilter.SearchFilterCollection = New SearchFilter.SearchFilterCollection(LogicalOperator.[And])
		searchFilterCollection1.Add(searchFilter1)
searchFilterCollection1.Add(searchFilter2)
Dim FoldersResults As FindFoldersResults
Try
	FoldersResults = myExchangeService.FindFolders(MailboxToAccess, searchFilterCollection1, folderView)
Catch ex As AccountIsLockedException
	Debug.Print("AccountIsLockedException: " & ex.Message)
End Try
It still trips the AccountIsLockedException, at this point…so I’m back to step 1.

Any suggestions would be greatly appreciated.

Thank you in advance for your time.

Paul Goldstein


Paul D. Goldstein Forceware Systems, Inc.


Viewing all articles
Browse latest Browse all 7132

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>