' THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Function GetEmailsMarkedForFollowUp(myOlFolder As Outlook.Folder) Dim objTable As Outlook.Table Dim objRow As Outlook.Row Dim strFilter As String Dim strReturn As String Dim myObjSubFolder As Outlook.Folder Dim intCurrent As Integer ' ignore certain folders in the interest of having outlook return sometime in the foreseeable future If (myOlFolder.Name = "Trash") Or (myOlFolder.Name = "Archive") Or (myOlFolder.Name = "Junk") Or (myOlFolder.Name = "Junk E-mail") Then GetEmailsMarkedForFollowUp = "" Exit Function End If ' clear string strReturn = "" ' Define a DASL filter that finds items marked for follow-up strFilter = "@SQL=" & Chr(34) & "http://schemas.microsoft.com/mapi/proptag/0x0E2B0003" & Chr(34) & " = 1" ' construct a table of items using the filter Set objTable = myOlFolder.GetTable(strFilter) With objTable ' Add task-related columns to the table. .Columns.Add ("TaskDueDate") ' this always seems to be blank in imap, but might be useful if you use exchange .Columns.Add ("Subject") .Columns.Add ("Categories") .Columns.Add ("SenderName") ' add flagged e-mails to the formatted task string Do Until .EndOfTable Set objRow = .GetNextRow strReturn = strReturn & "