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

Operation aborted (Exception from HRESULT: 0x80004004 (E_ABORT)) - outlook appointment

$
0
0

Hi

I am creating program to send the holiday date of staff  from sqlserver  table  to outlook calendar and I written the sample code. But when I run the code  and if no outlook is not open the error is coming  as given below

Operation aborted (Exception from HRESULT: 0x80004004 (E_ABORT)). How I can get rid of this error and make an appointmtent even if the outlook is not open.

private void button1_Click(object sender, EventArgs e)
        {

Microsoft.Office.Interop.Outlook.Application app = null;
            Microsoft.Office.Interop.Outlook.AppointmentItem appt = null;

            app = new Microsoft.Office.Interop.Outlook.Application();

            appt = (Microsoft.Office.Interop.Outlook.AppointmentItem)app
                .CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olAppointmentItem);
            appt.Subject = "Meeting ";
            appt.Body = "Test Appointment body";
            appt.Location = "TBD";
            appt.Start = Convert.ToDateTime("11/11/2016 05:00:00 PM");
            appt.Recipients.Add("test@company.com");
            appt.End = Convert.ToDateTime("12/11/2016 6:00:00 PM");
            appt.ReminderSet = true;
            appt.ReminderMinutesBeforeStart = 15;
            appt.Importance = Microsoft.Office.Interop.Outlook.OlImportance.olImportanceHigh;
            appt.BusyStatus = Microsoft.Office.Interop.Outlook.OlBusyStatus.olBusy;
            appt.Save();
            appt.Send();

}


polachan


WindowsFormsApplication1.Form1' does not contain a definition for 'Application' and no extension method

$
0
0

I have used the sample code to create a calendar for the date but the above mentioned error is coming

using System.Runtime.InteropServices;
using Outlook = Microsoft.Office.Interop.Outlook;

private void AddAppointment()
        {
            try
            {
                
                Outlook.AppointmentItem newAppointment =
                    (Outlook.AppointmentItem)
                this.Application.CreateItem(Outlook.OlItemType.olAppointmentItem);
                newAppointment.Start = DateTime.Now.AddHours(2);
                newAppointment.End = DateTime.Now.AddHours(3);
                newAppointment.Location = "ConferenceRoom #2345";
                newAppointment.Body =
                    "We will discuss progress on the group project.";
                newAppointment.AllDayEvent = false;
                newAppointment.Subject = "Group Project";
                newAppointment.Recipients.Add("Roger Harui");
                Outlook.Recipients sentTo = newAppointment.Recipients;
                Outlook.Recipient sentInvite = null;
                sentInvite = sentTo.Add("Holly Holt");
                sentInvite.Type = (int)Outlook.OlMeetingRecipientType
                    .olRequired;
                sentInvite = sentTo.Add("David Junca ");
                sentInvite.Type = (int)Outlook.OlMeetingRecipientType
                    .olOptional;
                sentTo.ResolveAll();
                newAppointment.Save();
                newAppointment.Display(true);
            }
            catch (Exception ex)
            {
                MessageBox.Show("The following error occurred: " + ex.Message);
            }
        }

The following error is coming 

'WindowsFormsApplication1.Form1' does not contain a definition for 'Application' and no extension method 'Application' accepting a first argument of type 'WindowsFormsApplication1.Form1' could be found (are you missing a using directive or an assembly reference?) 

Please help


polachan

Operation aborted (Exception from HRESULT: 0x80004004 (E_ABORT)) - Outlook Appointment error

$
0
0

Sorry for Duplicate posting .

Hi

I am creating program to send the holiday date of staff  from sqlserver  table  to outlook calendar and I written the sample code. But when I run the code  and if no outlook is not open the error is coming  as given below

Operation aborted (Exception from HRESULT: 0x80004004 (E_ABORT)). How I can get rid of this error and make an appointmtent even if the outlook is not open.

private void button1_Click(object sender, EventArgs e)
        {

Microsoft.Office.Interop.Outlook.Application app = null;
            Microsoft.Office.Interop.Outlook.AppointmentItem appt = null;

            app = new Microsoft.Office.Interop.Outlook.Application();

            appt = (Microsoft.Office.Interop.Outlook.AppointmentItem)app
                .CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olAppointmentItem);
            appt.Subject = "Meeting ";
            appt.Body = "Test Appointment body";
            appt.Location = "TBD";
            appt.Start = Convert.ToDateTime("11/11/2016 05:00:00 PM");
            appt.Recipients.Add("test@company.com");
            appt.End = Convert.ToDateTime("12/11/2016 6:00:00 PM");
            appt.ReminderSet = true;
            appt.ReminderMinutesBeforeStart = 15;
            appt.Importance = Microsoft.Office.Interop.Outlook.OlImportance.olImportanceHigh;
            appt.BusyStatus = Microsoft.Office.Interop.Outlook.OlBusyStatus.olBusy;
            appt.Save();
            appt.Send();

}


polachan

I need a macro for MS Outlook 2013 and 365

$
0
0

How to save message in the inbox into the same folder of another message shown on conversation

If I am using filter the inbox by date and using conversion view

the old messages under same conversation are already saved in a certain folder lets call it FFFF

and i can see on the inbox the folder name under the older messages

now i need to move the new message arrived into the same folder but i need to avoid

1- drag and drop from inbox pane to folder pane (i need to scroll and hover over all folders)

2- using the right click on message , then form the menu is select, move to other folder, then i start crolling from folder window

I prefer to select the new message (with out colder) and the older message (already in a folder)

and then click in something like

(Save in same folder) or

(merge in folder)

(move to same folder)

which does not exist under all commands or rules or any other way

I guess a Macro is the only way 

can you provide me with this macro

i can paste it and apply

Other descriptino to my problem

I always use the inbox in (conversation mode)

so new messages are inside the inbox , and old messages are in the other folders

I need to read the new message first, , rules here cannot work, since sender might change, or subject can be changed

after I read the new email, I will be able to see also the old email in the same view (with the folder name, where the other emails are saved) I need to have some way to drag and drop the new email into the folder without using the only way wich is moveto other folder and search inside long list of folders, or to search the folder first in thefolder pane, and drag and drop there (both ways takes time)

Possible solutions

  1. To have search window to search a folder

  2. To have something to show the folder name and can be used to drag and drop

  3. A command to (move in same folder) for group of emails some in (inbox) and at least one has got a folder

I am attaching some explanation on a snap


How to store holiday date from holiday table into outlook calendar

$
0
0

I’ve been asked to integrate our holiday table (Sqldatabase)  which is stored in an SQL Database with an outlook calendar, so that all holidays show in outlook calendar 

Please anybody help me to write the program in C# 

Regards

Pol


polachan

GetSharedDefaultFolder method

$
0
0
Hi My below piece of code works perfectly but when i change
Code:
Fldr = olNs.GetSharedDefaultFolder(objOwner, OlDefaultFolders.olFolderInbox)
to 
Code:
  Fldr = olNs.GetSharedDefaultFolder(objOwner, OlDefaultFolders.olFolderSentMail)
it doesnt work..

below is my full code.. please help me.
Code:
 Dim olApp As Outlook.Application
        Dim olNs As Outlook.NameSpace

        Dim olMail As Outlook.MailItem

        Dim i As Integer

        olApp = New Outlook.Application
        olNs = olApp.GetNamespace("MAPI")
        Dim Fldr As MAPIFolder
        Dim objOwner As Outlook.Recipient
        objOwner = olNs.CreateRecipient("HPI-API-IPGUS")
        objOwner.Resolve()

        If objOwner.Resolved Then
            MsgBox(objOwner.Name)
            Fldr = olNs.GetSharedDefaultFolder(objOwner, OlDefaultFolders.olFolderSentMail)

End Sub

            i = 1

            For Each olMail In Fldr.Items




                If InStr(olMail.Subject, "Invoice to Post") <> 0 Then
                    With olMail.ReplyAll

                        .HTMLBody = "Hi" & vbCrLf & .HTMLBody
                        .Display()
                    End With

                End If
            Next


        End If

Best way for continuously searching for emails when in Outlook online mode

$
0
0

Hi,

I'm hoping someone here has experience in this and knows of the pitfalls / best practices of searching for emails in Outlook.  The requirements for this are:

  • must be able to work in the background / not affect UI for the users
  • need to search all folders and sub-folders
  • search will being run every time user sends / receives email
  • need to be able to only return emails sent / received since previous search
  • must pass back EntryIDs of emails so these can be iterated over and data extract from the emails
  • must work with all versions of Exchange (including Exchange Online / Office 365)
  • must not affect Exchange server performance / user Outlook performance
  • must be able to handle 1000s of folders and 100,000s of emails

So far the options I have come across are:

AdvancedSearch (current method I use)

Pros

  • can be run in the background / has SearchComplete event
  • fast with large numbers of emails / folders / sub-folders
  • can return just EntryIDs so not too heavy

Cons

  • doesn't always fire SearchComplete event / just doesn't work
  • has performance issues when running in Outlook online mode (server CPU increase / Outlook slowdown)
  • relies on indexing of emails to be fast?

Items.Restrict

Pros

  • works well with large number of emails
  • might work better in online mode

Cons

  • can cause issues with Exchange since I've heard the server has a limit of the number of restrict queries it can run
  • not as easy to run in the background / untested whether affects Outlook performance

RDOFolderSynchronizer (Redemption)

Pros

  • is the same method Outlook uses to synchronise folder changes
  • can work in the background?
  • should be most accurate?

Cons

  • unknown how it affects performance of Outlook
  • need to manually iterate over all folders / sub-fodlers
  • need to persist and store sync hash
  • not sure whether hash works across multiple instances of Outlook for same user

So my question is, what would people recommend to better support when Outlook is in online mode?  Are there performance / known issues with any of these methods and ways to get around these?

Thanks for your help!

Tom

How to delete / cancel the appointment date in outlook calendar in Exchange server - Please help

$
0
0

Hi,

The following code I used for creating  the appointment in C# . Please can you help me  to write the code how to delete / cancel the appointment for the given date ,   from the following code

private void button2_Click(object sender, EventArgs e)
{
try
{

ExchangeService service = new ExchangeService();
string username = mycompany+ "\\" + "usersid";
service.Credentials = new WebCredentials(username, "myusername"); 
service.AutodiscoverUrl("myname@mycompany.com");
Appointment appointment = new Appointment(service);
appointment.Subject = "Testing Holiday";
appointment.Start = DateTime.Now;
appointment.End = appointment.Start.AddHours(1);
appointment.Save();
}

catch (Exception ex)
{

console.writeline("following error occurred: " + ex.Message);
}
}


polachan


Outlook

$
0
0

My Client application is trying to synchronize the contacts with outlook. It tries to get the contact folders and below exception is thrown by outlook.  

GUI stdout: Error While retrieving foldersSystem.Runtime.InteropServices.COMException (0x8A440201): The set of folders cannot be opened.


 May i know how to solve this exception ?

Outlook addin updates and starting Outlook from code

$
0
0

Hello,

We have an Outlook add-in which checks for updates every time Outlook starts.

We also use Outlook in our application, we start Outlook by creating Outlook.Application (_oapp = new Outlook.Application();)

Now we have a new version of our add-in and what we notice is that when our application is the first to start Outlook, the automatic update of the add-in does not trigger. Is there a way to ensure this happens?


Indexing error

$
0
0

Hello everyone,
I want to stop the Outlook pst indexing error. So my question is, could anyone suggest me a proper way so that I may never face such issue again? How to make outlook.pst repair?


Thanks for your help!

Form Region Displaying but unable to access programmatically

$
0
0

Hi, I've implemented a form region and it is displaying on outlook but when I want to access the form region in code the form region collection is empty. Globals.FormRegions returns no form regions.

How Can I Enumerate the Categories for a Shared Inbox?

$
0
0

I can easily get the Categories in Outlook for the default inbox using this: https://msdn.microsoft.com/en-us/library/ff424467.aspx.

However, I have been unable to figure out how to accomplish this for a shared inbox. Is it possible to enumerate the categories for a shared inbox? 

How can I check whether the Outlook is running with elevated privileges from code

$
0
0

Hi,

How can I check whether the outlook is running in elevated mode from the C# code?

I saw Marshal.GetActiveObject("Outlook.Application") as an example. 

But in the following MSDN link, they say nothing about the privilege.So can I use this to check the privileges or is there any better way?

Marshal.GetActiveObject

Thanks in advance.


Code page problem for contacts import from GMAIL to Outlook 2010

$
0
0

Hello there,

I have encountered a problem when trying to import my contacts from GMail to Outlook.
The problem is aggravated by the fact that my contacts are primarily in Cyrrilic (Russian) code page.
It seems the problem has been touched by some people in discussions already:

https://productforums.google.com/forum/#!topic/gmail/uIwsghkxNks


So I've used some of those advises as guidance and changed the Display language in Google before carrying on with Export from Gmail.

Frankly, I have tried all 3 saving options available in GMAIL, including the vCards format. By doing so I have managed to export my contacts into Excel . But it appears that the problem with code pages is also present in Outlook itself. 

In order to simplify the task of demonstrating you the essence of my problem I recorded my actions in video.

The 1st link I suggest you watch is the following one:

https://youtu.be/6RSb2Dj10BM

My comments to the above link are as follows:

1. I show how I download the contact list from GMAIL and settings that I use

(in video I demostrate how I did it for Google CSV, but actually I also tried to do the same for vCard and CSV for Outlook)

2. Then I go to Outlook and try to upload the contact list there. The video shows the errors that Outlook produced while I tried to do it.
In the process Outlook hangs up as can be seen.

I tried a few different saving options in order to upload the file, but nonetheless it always resulted in smth non-Cyrrilic that I am unable to read (lots of question marks).

3. In the end of the video I demonstrate that changing the settings for Outlook default language leads to disappearance of the option for data import in Outlook.

Since the original file that I downloaded directly from Google seemed a little questionable, I decided to set the the test of my own and created a new simple file with a few fictional contact names. You can watch what I did in the 2nd shorter video:

https://youtu.be/kQS8b95iNts

As you can see the problem apparently stands with Outlook itself. Because it is just unable to read the symbol encoding correctly. The only contact name that it shows correctly is the one that was originally written in English symbols. 

This problem with Unicode characters has been also discussed on the following page

https://jaimonmathew.wordpress.com/2011/08/23/excel_addin_to_work_with_unicode_csv/

However the solution from the above link doesn't seem sufficient when it comes to importing the contact data in Outlook. Because Outlook seemingly doesn't support Unicode characters either. So the problem is much deeper, and even applications from the same Office pack cannot exchange the encoded data properly.

Hope this helps you to provide a better guidance for me to carry on with data import to Outlook. 

Thanks.


Sender is null at a mailbox item in the sent box

$
0
0

Hi,

I am trying to get the sender from a sent mail (mail from the "sent" folder). In that case the sender is "" (In the "inbox" everything works fine).

var mailbox = Office.context.mailbox; if (mailbox.item.itemType === Office.MailboxEnums.ItemType.Message) var emailAddress = mailbox.item.sender.emailAddress;

// emailAddress === ""

Does anyone have an idea for a solution?

Best regards,
  David

Move all sent items to new a different folder in Outlook

$
0
0

I'm looking for help on creating a simple Visual Studio code to have all Outlook SENT ITEMS moved to a new folder that I've created called, SENT ITEMS-PERMANENT. The version of Outlook is for 2013/2016. Thanks for any help you can give me.

Paste a datagridview cell contents to the selection point in Outlook mailitem

$
0
0

I'm trying to paste a string into an outlook mailitem at the insertion point of my cursor. The string is coming from a datagridview. I'm using C# from vs2015 and outlook O365. This is what I'm trying:

private void button5_Click(object sender, EventArgs e)
        {
            {
                // Paste To Outlook
                object oItem;
                Outlook.Application oApp = new Outlook.Application();
                //Outlook.Application oInsp = Inspector.CurrentItem();
                Outlook.Explorer oExp = oApp.ActiveExplorer();
                Outlook.Selection oSel = oExp.Selection;
                // the current row
                int rwindex = dataGridView1.CurrentCell.RowIndex;
                oWordApp.Selection.TypeText(dataGridView1.Rows[rwindex].Cells[0].Value.ToString());
                oWordApp.Selection.TypeText(dataGridView1.Rows[rwindex].Cells[1].Value.ToString());
                // the current column
                int colindex = dataGridView1.CurrentCell.ColumnIndex;
                for (int ARows = 0; ARows <= dataGridView1.RowCount; ARows++)
                {
                    oWordApp.Selection.TypeText(dataGridView1.Rows[ARows].Cells[colindex].Value.ToString());
                }
            }
        }

Of course this is not right, but I can't find information to help me figure it out. I modified the above code from where I'm pasting into a Word document from the datagridview, that part does work.


Resend Outlook email using VB when reminder starts

$
0
0

Hi everyone,

I am trying to have a VB code in Outlook, which resend an email when (a) it is assigned to a specific category [Send Message] and (b) its reminder starts.

Everything is working except:

  1. Attachment(s) cannot be included
  2. Email is in plain text, prefer HTML so tables and format can be remained

Appreciate for any help. Thanks in advance.

Cheers,

Celic

'Credit: http://www.slipstick.com/developer/send-email-outlook-reminders-fires/

Private Sub Application_Reminder(ByVal Item As Object)
  Dim objMsg As MailItem
  Set objMsg = Application.CreateItem(olMailItem)

If Item.Categories <> "Send Message" Then
  Exit Sub
End If

  objMsg.To = Item.To
  objMsg.Subject = Item.Subject
  objMsg.Body = Item.Body
  objMsg.Attachments = Item.Attachments
  objMsg.Send

  Set objMsg = Nothing
End Sub

Creating a customized pop up message on outlook 2013

$
0
0

I'm trying to avoid the ReplyAll mistake which normally happened in my organization.

Rather than reply to all, I would like to have some sort of pop-up alert  to remind the sender before sending out an email.

I know there's some freeware to do this out there is there any official add-in from Microsoft or alternative for me to achieve this?

Any help to point me in the right direction is highly appreciated.

Viewing all 6421 articles
Browse latest View live


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