SharePoint - Sending Meeting Request from sharepoint?

Asked By thulasiram G on 29-May-12 04:59 AM
Hi friends...

How to send Meeting request From Sharepoint Programmatically. And also i can able to Update the meeting request.

Please Suggest me some useful links or code ASAP.

Thanks in advance
Somesh Yadav replied to thulasiram G on 29-May-12 05:14 AM

Hi,

    Have a look to this demo code i wrote.


             DateTime d1 =new DateTime(2010,3,22,18,00,00);

            DateTime d2 = new DateTime(2010, 3, 22, 18, 30, 00);


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


            AppointmentItem item = (Microsoft.Office.Interop.Outlook.AppointmentItem)app.CreateItem(OlItemType.olAppointmentItem);

            item.Subject = "Configured Programmatically";

            item.Location = "India";

            item.Start = d1;

            item.End = d2;

            item.AllDayEvent = false;

            item.Body = "Meeting";

            item.ReminderSet = true;

            item.ReminderMinutesBeforeStart = 15;

            item.Save();  // Use this statement to save meeting request to outlook


thulasiram G replied to Somesh Yadav on 29-May-12 05:23 AM
Hi Somesh Yadav..

Thanks for Your Reply...

In my server Outlook is not installed, So it wont work in server. without using Outlook if u have any code/Links please suggest me i will go through it. And also i can able to update also.

Thanks in advance
Jitendra Faye replied to thulasiram G on 29-May-12 06:45 AM
After searching I got this solution, hope this will help you.

class MeetingRequest
{

//Get the site ID

public static string GetSMTPHostName(Guid siteID)
{
using (SPSite site = new SPSite(siteID))

{

//Get the SMTP host name from “Outgoing e-mail settings”

return site.WebApplication.OutboundMailServiceInstance.Parent.Name;

}

}
//Get Outgoing email server settings
public static string GetFromEmailID(Guid siteID)
{

using (SPSite site = new SPSite(siteID))

{

//Get the “from email address” from “Outgoing e-mail settings”

return site.WebApplication.OutboundMailSenderAddress;

}

}
//Send Meeting Request with

public static void SendMeetingRequest(SPWeb web, string listName, int itemID, string organizerEmail, List<string> toEmailList, string title, string body)

{

Guid siteID = web.Site.ID;

iCal ical = new iCal();

string icalData = ical.GetICSFormat(web, listName, itemID, organizerEmail);

MailMessage msg = new MailMessage();

msg.From = new MailAddress(organizerEmail);

if (toEmailList.Count > 0)

{

for (int i = 0; i < toEmailList.Count; i++)

{

msg.To.Add(toEmailList[i]);

}

}

msg.Subject = title;

msg.Body = body;

AlternateView htmlView = AlternateView.CreateAlternateViewFromString(body, new ContentType(“text/html; method=request; charset=UTF-8;component=vevent”));

System.Net.Mime.ContentType ct = new System.Net.Mime.ContentType(“text/calendar”);

ct.Parameters.Add(“method”, “REQUEST”);

AlternateView avCal = AlternateView.CreateAlternateViewFromString(icalData, ct);

msg.AlternateViews.Add(avCal);

msg.AlternateViews.Add(htmlView);

SmtpClient clt = new SmtpClient(GetSMTPHostName(siteID));

try

{

clt.Send(msg);

}

catch { }

}

}

Refer this link also-

http://nhutcmos.wordpress.com/2010/12/28/deliver-meeting-request-from-sharepoint-calendar-programmatically/


thulasiram G replied to Jitendra Faye on 29-May-12 07:59 AM
Hi vickey...

Thanks for your reply....

 refer this We can send meeting request simply like this 

http://weblogs.asp.net/bradvincent/archive/2008/01/16/creating-vcalendars-programmatically.aspx 

with this code i'm unable to update the meeting request.

please suggest me if there any code to update meeting request