Quantcast
Channel: Outlook for Developers forum
Viewing all 6421 articles
Browse latest View live

Email using Outlook from VBscript does not run in Task Scheduler

$
0
0

Tech people,

I have been working on resolving an issue that involves generating an email from database information and sending through outlook.  I have got code working perfectly, so long as I run myself.  When I try to run as a Task, the email does not get sent. It does not error, but it stops processing at the command, email.send.  The code is below.  Is this a limitation of Windows?  Or is it that I am not technically logged in as myself when the job is run, therefore it can't send?  I am not getting any errors, so it is making it a bit difficult in getting to a solution.

Thanks a bunch!

David Langschied

'Define Constants
Const ForReading = 1
Const ForWriting = 2
Const olFolderInbox = 6

'Set variable values
strComputer = "."
MFolder = "C:\v-email\remit\"
AFolder = "C:\v-email\remit\archive\"

'Generate Outlook objects
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery _
    ("Select * From Win32_Process Where Name = 'outlook.exe'")
Set oFSOInput = CreateObject("Scripting.FileSystemObject")

'If outlook is not running, open it
If colItems.Count = 0 Then
    Set objOutlook = CreateObject("Outlook.Application")
    Set objNamespace = objOutlook.GetNamespace("MAPI")
    objNamespace.Logon "Default Outlook Profile",, False, True    
    Set objFolder = objNamespace.GetDefaultFolder(olFolderInbox)
    objFolder.Display
End If

'Move through the Mail folder looking for .mail files, generate email, send, and move file to archive
For Each oInputFile In oFSOInput.GetFolder(MFolder).Files
    oFileParts = split(oInputFile.Name,".") 
    oInputFileExt = oFileParts(1)
    oInputFileName = oFileParts(0)
    If LCase(oInputFileExt) = "mail" Then
'Process mail file
ProcessFiles oFSOInput, oInputFile
'Move mail file to archive
oFSOInput.MoveFile oInputFile,AFolder 
    End if
Next

'Clear File object
Set oFSOInput = Nothing

Sub ProcessFiles(FSOInput, InputFile)
    'Set Input Object
    Set InputFile2 = FSOInput.OpenTextFile(InputFile.path, ForReading)
    'Loop through file line by line
    Do Until InputFile2.AtEndOfStream
        strLine = InputFile2.ReadLine
        strLineNo = strLineNo + 1
        'First time through, generate HTML for email body
        If strLineNo = 1 then
   oMailBody = "<!DOCTYPE HTML PUBLIC ""-//W3C//DTD W3 HTML//EN"">"
    oMailBody = oMailBody & "<HTML>" & vbcrlf
    oMailBody = oMailBody & "<HEAD><TITLE>No Invoices</TITLE></HEAD>"
    oMailBody = oMailBody & "<BODY>" & vbcrlf
End If
        'First four lines of file contain the from, to, cc, and subject
        If strLineNo <= 4 then
            If Left(strLine, 5) = "FROM:" then
                oMailfrom = Mid(strLine,6,52)
            End If
            If Left(strLine, 3) = "CC:" then
                oMailcc = Mid(strLine,4,52)
            End If
            If Left(strLine, 3) = "TO:" then
                oMailto = Mid(strLine,4,52)
            End If
            If Left(strLine, 8) = "SUBJECT:" then
                oMailsubj = Mid(strLine,9,80)
            End If
        Else
   'After line four, all the rest is text for the email body
   oMailbody = oMailbody & "<br>" & strLine & "</br>"
        End If
    Loop
    'Close off teh HTML of the body
    oMailBody = oMailBody & "</BODY></HTML>" 
    'Close all and clean up
    InputFile2.close
    set InputFile2 = Nothing
    'With all info, now create email
    SendMessage oMailfrom, oMailcc, oMailto, oMailsubj,  oMailbody
end sub

Sub SendMessage(Mailfrom, Mailcc, Mailto, Mailsubj, Mailbody)
    'Set email objects
    Set oolApp = CreateObject("Outlook.Application")
    Set email = oolApp.CreateItem(0)
    'Set email components
    email.Recipients.Add(Mailto)
    email.Subject = Mailsubj
    email.HTMLBody = MailBody
    'Send email
    email.Send
End Sub



Share One Appointment on Two Seperate Calendars at the same time?

$
0
0

I have a shared mailbox with about 6 people accessing it all day everyday.  They create a lot of appointments on the default calendar.  I now have a second calendar and I have published it.  I would like to start creating all appointments for one particular section of a project on the published calendar and leave the rest on the default unpublished calendar.

Problem is the appointments on the published calendar cannot overlap times on the appointments in the default calendar.  So I need to know is there a way to create an appointment and have it exist on BOTH calendars so if you edit the appointment on one calendar the other calendar will reflect the changes?

I posted the above two paragraphs in the OFFICE forum and was told there was no possible way to do what I was wanting unless I used coding.  So if anyone could help me do this I would greatly appreciate you.

I have office Office Pro Plus 2013 and the drafters will have it soon, but they currently have Office 2010 - either Standard or ProPlus.  I could upgrade them at anytime if need be.

Thank you in advance - GJ

Link Preview feature in OWA code behind it

$
0
0

Hi,

We have a query from the user and concern about this feature and would like to understand the code and concept behind this. how does this work?

Does Microsoft has access to any user email content to present this or how does the content being presented.

https://support.office.com/en-US/client/results?Shownav=true&lcid=1033&ns=OLWAO365B&version=15&omkt=en-US&ver=15&v=15.1.390.13&mode=Desktop&helpid=ms.exch.owab.LinkPreview

i understand we can turn on/off but any background info would be very helpful! 

Please let me know.

Thanks.

Creating a link to owa based on information stored in pst

$
0
0

Hello,

For a search project we're looking into a solution to aggregate mail-items that are stored in a pst-file, specifically to offload the proces and prevent EWS from throttling. The goal is to provide a link to owa in the search results.

We're able to get metadata from mail-items. We need to build the link to owa, which needs to look something like this: https://owa.company.com/owa/?ae=Item&a=Open&t=IPM.Note&id=RgAAAAApb9sYhvWmRbwpx12zhgjzBwBjCjkHwI53R4Yk9qQoWCFVAAAA9qoNAABjCjkHwI53R4Yk9qQoWCFVAACtcboGAAAJ

As you can see it contains an id, I believe this is the mail-id or the thread-id. Is this ID stored by default in the metadata of mail-items when they are stored in a pst? If not, how can I make it so?

Kind regards,

Kenney

Difference between attachments->Remove(index) and attachment->Delete()

$
0
0

I am developing an C++ COM ATL add-in for outlook. I am encountering outlook crashes with office 2016 release.

The crash location was localized to AttachmentPtr->Delete() function. On further analysis it was found that AttachmentsPtr->Remove(index) works fine in outlook 2016. However, it crashes in 2010 and 2013. I am not sure where the problem lies.

Any help would be appreciated.

To be very precise:

1. Compose new mail. Add some text to body.

2. Set body format to RTF.

3. Embed 1 inline object. 

4. Add 1 attachment and Send the mail.

I am listening to Send event of MailItem. Here is what goes inside listener.

1. In the send event, when i try to delete the normal attachment outlook 2016 crashes. 

2. It is working fine in 2013 and 2010.

If i try to delete it with Remove function of attachment collection with attachment index as parameter, it works fine in 2016, but starts crashing in 2013 and 2010.

I have no clue what is happening. Please help.

Thanks,

Yogesh K.

Prerequisites in Office for IM Application Integration

$
0
0

Hello, I have successully implemented an IM application integration for Office, following the documentation:

"Integrating IM applications with Office" (https://msdn.microsoft.com/en-us/library/office/jj900715.aspx)

On machines running Office 2013 Professional incl. Lync, it runs out of the box. On machines running Office 2016 Professional, it works as well.

But when our software is installed on a machine with Office 2013 Standard (without Lync / Skype), the integration does not work. I don't find the relevant dlls in the Office program files folder, Office does not invoke the interfaces of theUCCollaborationLib.

Question: What are the requirements for Office for enabling this feature? Is there any redistributable that I could include in the installer?

The documentation only reads: "The APIs for this integration are included in the UCCollborationLib namespace that is contained in the Microsoft.Office.UC.dll file, which is installed with certain versions of Office 2013."

Wolfgang


MS Office/Outlook Presence Integration C# COM Server

$
0
0

I want to implement the Outlook Presence integration for Outlook 2010, 2013 and up.

 

I tried to follow the instructions found in the article "Integrating IM applications with Office" (https://msdn.microsoft.com/en-us/library/office/jj900715.aspx) and implemented theIUCOfficeIntegration Interface in my C# Application. I created an C# Exe that registers the class for COM Interop by basing my code on the official Example How to develop an out-of-process COM component by using Visual C++, Visual C#, or Visual Basic .NET (https://support.microsoft.com/de-de/kb/977996)

When I run the C# COM Server I am able to instantiate the registered class from another C# Application using the following code:

Guid clsid =newGuid("394376DD-3BB8-4804-8CCC-9559434004F3");Type t =Type.GetTypeFromCLSID(clsid,true);object i =Activator.CreateInstance(t);

When the COM Server does not run I get the Error HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG) as expected.
I enabled Outlook Presence Logging as described in (https://technet.microsoft.com/en-us/library/ff678502.aspx), started the C# COM Server set up the registry keys but Outlook is not able to instantiate my COM Class even though the C# Test app can do it. The constructor of the interface class is never called as the log statements are not getting executed.

In the Outlook Log I get the following error line multiple times:

hr = 80040154, We couldn't identify the provider type we now try to manually CoCreate using the LCClient CLSID
I checked the registry keys but they are correct. For some yet unknown reason it does not work. The docs say Outlook would use CoCreateInstance with the CLSID to instantiate the class. I also tried to simply use a C# COM Interop DLL instead of the COM Server but I get the same behaviour there.

If helpful I can provide the whole program source that implements the interface.

What do I need to do to make outlook able to find and instantiate my class?



C# sending mhtml file contents in an Microsoft Outllook email

$
0
0

Hi,

I have a requirement of sending mhtml file in Outlook email. While I have the script to send an email, I am not entirely sure how to successfully convert the contents of mhtml file into a string that when sent as an email is rendered correctly in Microsoft Outlook.

Does anyone have a working script that converts mhtml file contents to a string?

Please assist.

Thanks







Have problem with Office 2013 send from title.

$
0
0

I have this macros its okey

Dim WithEvents objInspectors As Outlook.Inspectors
Dim WithEvents objMailItem As Outlook.MailItem
Dim WithEvents myOlExp As Outlook.Explorer

Private Sub Application_Startup()
    Initialize_handler
End Sub

Public Sub Initialize_handler()
    Set objInspectors = Application.Inspectors
    Set myOlExp = Application.ActiveExplorer
End Sub

Private Sub objInspectors_NewInspector(ByVal Inspector As Inspector)
    If Inspector.CurrentItem.Class = olMail Then
        Set objMailItem = Inspector.CurrentItem
        If objMailItem.Sent = False Then
            Call SetFromAddress(objMailItem)
        End If
    End If
End Sub

'Uncomment the next 3 lines to enable Outlook 2013 Reading Pane Reply
'Private Sub myOlExp_InlineResponse(ByVal objItem As Object)
'    Call SetFromAddress(objItem)
'End Sub

Public Sub SetFromAddress(oMail As Outlook.MailItem)
    ' Set your preferred default From address below.
    ' Exchange permissions determine if it is actually stamped
    ' as "Sent On Behalf Of" or "Sent As".
    ' The address is not properly updated for the InlineResponse
    ' feature in Outlook 2013. This is only a visual bug.
    oMail.SentOnBehalfOfName = "delegate@domain.com"
End Sub

Then u send email u can choose default address from button, but if u can replay email, the address change a default account exchange, how make then always to be address on default other address not a main account.

OL 2016 Set Storage Folders

$
0
0

For some time I have been using VBA code shown here to set the storage folders for sent mailhttp://www.outlookcode.com/d/code/setsavefolder.htm this has worked fine in various versions of Outlook, including 2016.

However whilst it was working fine in OL 2016 in the last two days the function has not been available. Nothing I am aware of has been changed, or any software been added, current Office branch being v16.0.6366.2056

I'm puzzled

T/Y

Get token from outlook

$
0
0

I don't know whether microsoft have open the api to provide token for Add-In 's developed.But Now My project need to get the information of the user that login in outlook at  this moment.Anybody can give  me  the methods to solve it?

What is the filename & path for Outlook 2010 (local) contact form template

$
0
0

Problem: A user can not read the font in her Outlook 2010 contacts on a local machine.

Solution: I have enabled the Developer tab and created a Contacts form with 11pt. font in every data field.

Questions:

Can I save this form as a template which will open with the existing contacts? Regardless, what filename & path do I use?

Or am I going to have to export all her contacts in csv, then delete all her contacts, and import the csv? It's not problem if that's what it takes; I just want to make sure before I do it.

Thanks!

Read and Update Values From Default Appointment Form in Outlook

$
0
0

Hi,

    I do not need to modify the default form structure for add/ update of appointments.

I only need to read the values in the form, such as attendee list, start and end DateTime of the appointment.

I cannot use the AppointmentItem object, since the values in the form are not yet saved into the object.

I simply could not find the properties and members of the default Appointment form, so I am unable to proceed.

Also:

1) if I can read the Appointment form values, can I also modify them?

2) as and when the Appointment form values change, I want the dependent properties in my form to get updated as well. How can I achieve this?

Background: I have created a separate form region (for IPM.Appointment messages), that does some additional processing based on the attendee list and meeting time. This needs to refer the latest value entered by the user into the Appointment form (rather than AppointmentItem object).


Need to run/invoke macro from c# code for Outlook Addin

$
0
0

Hi ,

My requirement demands that i need to execute some macro functions from outlook Addin which is written in  c# code .I was able to do it for all other office products expect for outlook as i don't have access to VBAProject object inside outlook office interloper library .SO please suggest any solution to get rid of this issue .

Let me know if u need more information.Thanks

C# Outlook programming mail item

$
0
0

Hello everyone,

I need create method which will replay to all recipients in Microsoft outlook. But when I open manually received mail I want that method replay to all in open mail item. Can I do it? If I can 


Outlook 2010 Shared Calendar Export

$
0
0

Hi,

I have the below code, which will export my own calendar - how do i specify the other shared calendars i want to export to the same file?

Sub ExportAppointmentsToExcel()
    'On the next line, edit the list of calendars you want to export.  Each entry is the path to a calendar.  Entries are separated by a comma.
    Const CAL_LIST = "tul0crf@123.com\Calendar"
    'On the next line, edit the path to and name of the Excel spreadsheet to export to
    Const EXCEL_FILE = "\\ketpddsc01\users\tul0crf\Tester.xlsx"
    Const SCRIPT_NAME = "Export Appointments to Excel (Rev 2)"
    Const xlAscending = 1
    Const xlYes = 1
    Dim olkFld As Object, _
        olkLst As Object, _
        olkRes As Object, _
        olkApt As Object, _
        olkRec As Object, _
        excApp As Object, _
        excWkb As Object, _
        excWks As Object, _
        lngRow As Long, _
        lngCnt As Long, _
        strFil As String, _
        strLst As String, _
        strDat As String, _
        datBeg As Date, _
        datEnd As Date, _
        arrTmp As Variant, _
        arrCal As Variant, _
        varCal As Variant
    strDat = InputBox("Enter the date range of the appointments to export in the form ""mm/dd/yyyy to mm/dd/yyyy""", SCRIPT_NAME, Date & " to " & Date)
    arrTmp = Split(strDat, "to")
    datBeg = IIf(IsDate(arrTmp(0)), arrTmp(0), Date) & " 12:00am"
    datEnd = IIf(IsDate(arrTmp(1)), arrTmp(1), Date) & " 11:59pm"
    Set excApp = CreateObject("Excel.Application")
    Set excWkb = excApp.Workbooks.Add()
    Set excWks = excWkb.Worksheets(1)
    'Write Excel Column Headers
    With excWks
        .Cells(1, 1) = "Calendar"
        .Cells(1, 2) = "Category"
        .Cells(1, 3) = "Subject"
        .Cells(1, 4) = "Starting Date"
        .Cells(1, 5) = "Ending Date"
        .Cells(1, 6) = "Start Time"
        .Cells(1, 7) = "End Time"
        .Cells(1, 8) = "Hours"
        .Cells(1, 9) = "Attendees"
    End With
    lngRow = 2
    arrCal = Split(CAL_LIST, ",")
    For Each varCal In arrCal
        Set olkFld = OpenOutlookFolder(CStr(varCal))
        If TypeName(olkFld) <> "Nothing" Then
            If olkFld.DefaultItemType = olAppointmentItem Then
                Set olkLst = olkFld.Items
                olkLst.Sort "[Start]"
                olkLst.IncludeRecurrences = True
                Set olkRes = olkLst.Restrict("[Start] >= '" & Format(datBeg, "ddddd h:nn AMPM") & "' AND [Start] <= '" & Format(datEnd, "ddddd h:nn AMPM") & "'")
                'Write appointments to spreadsheet
                For Each olkApt In olkRes
                    'Only export appointments
                    If olkApt.Class = olAppointment Then
                        strLst = ""
                        For Each olkRec In olkApt.Recipients
                            strLst = strLst & olkRec.Name & ", "
                        Next
                        If strLst <> "" Then strLst = Left(strLst, Len(strLst) - 2)
                        'Add a row for each field in the message you want to export
                        excWks.Cells(lngRow, 1) = olkFld.FolderPath
                        excWks.Cells(lngRow, 2) = olkApt.Categories
                        excWks.Cells(lngRow, 3) = olkApt.Subject
                        excWks.Cells(lngRow, 4) = Format(olkApt.Start, "mm/dd/yyyy")
                        excWks.Cells(lngRow, 5) = Format(olkApt.End, "mm/dd/yyyy")
                        excWks.Cells(lngRow, 6) = Format(olkApt.Start, "hh:nn ampm")
                        excWks.Cells(lngRow, 7) = Format(olkApt.End, "hh:nn ampm")
                        excWks.Cells(lngRow, 8) = DateDiff("n", olkApt.Start, olkApt.End) / 60
                        excWks.Cells(lngRow, 8).NumberFormat = "0.00"
                        excWks.Cells(lngRow, 9) = strLst
                        lngRow = lngRow + 1
                        lngCnt = lngCnt + 1
                    End If
                Next
            Else
                MsgBox "Operation cancelled.  The selected folder is not a calendar.  You must select a calendar for this macro to work.", vbCritical + vbOKOnly, SCRIPT_NAME
            End If
        Else
            MsgBox "I could not find a folder named " & varCal & ".  Folder skipped.  I will continue processing the remaining folders.", vbExclamation + vbOKOnly, SCRIPT_NAME
        End If
    Next
    excWks.Columns("A:I").AutoFit
    excWks.Range("A1:I" & lngRow - 1).Sort Key1:="Category", Order1:=xlAscending, Header:=xlYes
    excWks.Cells(lngRow, 8) = "=sum(H2:H" & lngRow - 1 & ")"
    excWkb.SaveAs EXCEL_FILE
    excWkb.Close
    MsgBox "Process complete.  I exported a total of " & lngCnt & " appointments were exported.", vbInformation + vbOKOnly, SCRIPT_NAME
    Set excWks = Nothing
    Set excWkb = Nothing
    Set excApp = Nothing
    Set olkApt = Nothing
    Set olkLst = Nothing
    Set olkFld = Nothing
End Sub

Private Function OpenOutlookFolder(strFolderPath As String) As Outlook.MAPIFolder
    ' Purpose: Opens an Outlook folder from a folder path.
    ' Written: 4/24/2009
    ' Author:  David Lee
    ' Outlook: All versions
    Dim arrFolders As Variant, _
        varFolder As Variant, _
        bolBeyondRoot As Boolean
    On Error Resume Next
    If strFolderPath = "" Then
        Set OpenOutlookFolder = Nothing
    Else
        Do While Left(strFolderPath, 1) = "\"
            strFolderPath = Right(strFolderPath, Len(strFolderPath) - 1)
        Loop
        arrFolders = Split(strFolderPath, "\")
        For Each varFolder In arrFolders
            Select Case bolBeyondRoot
                Case False
                    Set OpenOutlookFolder = Outlook.Session.Folders(varFolder)
                    bolBeyondRoot = True
                Case True
                    Set OpenOutlookFolder = OpenOutlookFolder.Folders(varFolder)
            End Select
            If Err.Number <> 0 Then
                Set OpenOutlookFolder = Nothing
                Exit For
            End If
        Next
    End If
    On Error GoTo 0
End Function

Thanks,

Cam


Strange error in sending the mail through C# WinForm

$
0
0
hi

i have this code for sending mail through C# WinForm.

i have this reference:

    Microsoft.Office.Interop.Outlook (version 11.0)

my code:

   
 string sampleSource = System.Windows.Forms.Application.StartupPath + @"\TEST.txt";     string sampleDisplayName = "Test";    Microsoft.Office.Interop.Outlook.Application sampleApp = new Microsoft.Office.Interop.Outlook.Application();    Microsoft.Office.Interop.Outlook.MailItem sampleMessage = (Microsoft.Office.Interop.Outlook.MailItem)sampleApp.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem);    Microsoft.Office.Interop.Outlook.Recipient sampleRecipient = (Microsoft.Office.Interop.Outlook.Recipient)sampleMessage.Recipients.Add(sampleSource);    sampleRecipient.Resolve();    sampleMessage.Subject = "Test sub"    sampleMessage.BodyFormat = Microsoft.Office.Interop.Outlook.OlBodyFormat.olFormatHTML;    FinalMSG = "Test msg";    sampleMessage.HTMLBody = FinalMSG;    sampleMessage.To = "MyMail@gmail.com";    int samplePosition = (int)sampleMessage.Body.Length + 1;    int sampleType = (int)Microsoft.Office.Interop.Outlook.OlAttachmentType.olByValue;    Microsoft.Office.Interop.Outlook.Attachment sampleFile = sampleMessage.Attachments.Add(sampleSource, sampleType, samplePosition, sampleDisplayName);    sampleMessage.Save();    sampleMessage.Send();    sampleRecipient = null;    sampleFile = null;    sampleMessage = null;    sampleApp = null;



Sometimes it works Excellent and sometimes i got this error:

    Retrieving the COM class factory for component with CLSID {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80080005.

i try it on computer with outlook 2010...2013..2016  and same problem.

Can not find why sometimes it works and sometimes not

thanks

VBA Outlook - getshareddefaultfolder

$
0
0

Hi,

I'm looking to specify multiple Recipients in my code but unsure how i can do that...

Dim myNameSPace As Outlook.NameSpace
 Dim myRecipient As Outlook.Recipient
 Set myNameSPace = Application.GetNamespace("MAPI")
 Set myRecipient = myNameSPace.CreateRecipient("Hill Harry")
 Dim CalendarFolder As Outlook.Folder
 Set CalendarFolder = myNameSPace.GetSharedDefaultFolder(myRecipient, olFolderCalendar)
 Dim CalendarItem As Outlook.AppointmentItem

Work around 0x00040380 error when getting PR_USER_X509_CERTIFICATE property from local address book

$
0
0

1. what we do to find available recipient certificate from local AB (Contacts) ...

	vector<BinBufferPtr> EWOLRecipients::GetABCertificatesByEntryID(const CBinary& binEntryID, IMAPISessionPtr spMAPISession )
	{
		vector<BinBufferPtr> retVal;
		IMAPIPropPtr spProp;
		ULONG ulObjType;

		if (!spMAPISession)
			return retVal;

		HRESULT hr = spMAPISession->OpenEntry(  binEntryID, binEntryID, (LPGUID) &__uuidof(IMAPIProp),
			MAPI_BEST_ACCESS, &ulObjType, (IUnknown**) &spProp );

		if ( SUCCEEDED( hr ) && ( spProp != NULL ) )
		{
			vector<CBinary> certsAB;
			CGetProp prop( PR_USER_X509_CERTIFICATE, NULL );

			// 0x00040380 eror happen
			hr = spProp->GetProps( prop, 0, prop, prop );

			hr = prop.GetProp(PR_USER_X509_CERTIFICATE, certsAB);
			if(SUCCEEDED(hr))
			{
				for ( size_t i=0; i<certsAB.size(); i++)
				{
					// push back user certs
				}
			}
		return retVal;
	}

2.  what is our problem ...

In the compose form when user choose recipients with certificate available in local AB from AB pop-up dialog (inside dialog user choose "Contacts" and from the list of users choose user which has certificate) everything works and we able to get certs of the recipient.

In same time if user will "reply" to e-mail and recipient field will be preset with sender e-mail address, or user type e-mail address without click "enter" to auto-complete AB suggestion, we will try to retrieve certificate for such recipient and it will fail with "0x00040380" error to get property.

3. the idea of work around  ... 

I am thinking to find the recipient by e-mail address in Contacts folder manually using "Restrict" and get user certificate or get EntryID and pass it to the same function which failed.

		_ApplicationPtr pApp("Outlook.Application");
		_NameSpacePtr ns = pApp->GetNamespace(L"MAPI");
		MAPIFolderPtr spContactsFolder = ns->GetDefaultFolder(olFolderContacts);
		_bstr_t bstrRestriction(L"[Email1Address] = \"");
		bstrRestriction += wstrEmail.c_str();
		bstrRestriction += L"\" Or [Email2Address] = \"";
		bstrRestriction += wstrEmail.c_str();
		bstrRestriction += L"\" Or [Email3Address] = \"";
		bstrRestriction += wstrEmail.c_str();
		bstrRestriction += L"\"";
		_ItemsPtr spContactsFolderItemsRestricted = spContactsFolder->Items->Restrict(bstrRestriction);
		long lCount = spContactsFolderItemsRestricted->Count;
		if (lCount > 0)
		{
			for (long i = 1; i <= lCount; ++i)
			{
				IDispatchPtr spDispItem = spContactsFolderItemsRestricted->Item(_variant_t(i));
				_ContactItemPtr spRetVal = spDispItem;
				if (spRetVal)
				{
					_bstr_t userCert = spRetVal->UserCertificate;
					_bstr_t id = spRetVal->EntryID;
//					wstring _wid(id);
//					CBinary _bid(_wid.size(), (LPBYTE)_wid.c_str());
//					GetABCertificatesByEntryID(_bid, spMAPISession);
//					UserPropertiesPtr props = spRetVal->GetUserProperties();
					break;
				}
			}
		}

4. The EntryId I am getting from contact found is different than actual contact's EntryId. UserCertificate property of the "_ContactItemPtr" is obsolete and return NULL at least on OL2016. I am definitely missing something with my idea or it is completely wrong approach.

Is there any suggestions to fix my "work around" code or take different approach? Why at the first place user picked from AB interface will return certificate and the same user e-mail inserted by typing will not?

Thank you.


Slava Ivanov

Outlook Web Access - URL preview pane. Can I control which image gets selected from the site ?

$
0
0

Hi 

I'm developing a site for my boss.  My boss wants to be able to send links from this site to people, and likes the preview pane.

However - the preview pane randomly selects the same graphic every time, which is undesirable in the preview pane.  My boss would prefer the preview pane to select our company logo instead.

Is there any method I can use, some form of tag I can place into the html on my site, which would allow OWA to recognise that "this is the image you are looking for " ?

Thanks

Justin




Viewing all 6421 articles
Browse latest View live


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