SharePoint - Export SharePoint event to Outlook Calendar - Question for Alon Havivi

Asked By Jason
10-Aug-11 10:46 AM
Hi There,

How do you go about in using the custom webpart that Alon Havivi built? (Here is the link to the page that I am referring to: http://www.eggheadcafe.com/sample-code/SharePoint/017042ae-f0f6-47bb-be56-6c8296fe78b7/export-sharepoint-event-to-outlook.aspx)

I am in need of having a process available which will update the calendars of both Outlook and Non-Outlook users. The end user will select a date for a training event (from a form created within InfoPath) and that event should be automatically populated within the calendar of the user (as per the created SharePoint workflow).

Thanks,
Jason
  Ravinder Jamgotre replied to Jason
10-Aug-11 11:34 AM
You need to create a Custom Web Part CEWP and then in the editor window copy and paste the code from Alon Havivi solution; apply and ok and the web part weill show on the page you have placed it on,
  Jason replied to Jason
10-Aug-11 03:17 PM
Hi Ravinder,

Thank you for the response. I inserted the "Content Editor" webpart onto my SharePoint page and I copied and pasted the following code as per your instructions:

SPList list = SPContext.Current.Web.Lists["Calendar"];
SPListItem item = list.GetItemById(Convert.ToInt32(ddlEvents.SelectedValue));
string location = item["Location"] as string;
string subject = item.Title;
string description = item["Description"] as string;
DateTime beginDate = (DateTime)item["Start Time"];
string beginDateString = beginDate.ToUniversalTime().ToString("yyyyMMdd\\THHmmss\\Z");
DateTime endDate = (DateTime)item["End Time"];
string endDateString = endDate.ToUniversalTime().ToString("yyyyMMdd\\THHmmss\\Z");

string[] contents = {"BEGIN:VCALENDAR",
"PRODID:-//My company//My product//EN",
"BEGIN:VEVENT",
"DTSTART:" + beginDateString,
"DTEND:" + endDateString,
"LOCATION:" + location,
"DESCRIPTION;ENCODING=QUOTED-PRINTABLE:" + description,
"SUMMARY:" + subject, "PRIORITY:3",
"END:VEVENT",
"END:VCALENDAR" };

HttpResponse response = HttpContext.Current.Response;
response.Clear();
response.ContentType = "text/calendar";
response.AddHeader("Content-disposition", "attachment;filename=event" + ddlEvents.SelectedValue + ".ics");
response.Write(string.Join("\r\n", contents));
response.Write(contents);
response.Flush();

After hitting, okay, the code now has now displayed exactly as is above but within my SharePoint page.  I also noticed on Alon's original post, he had included a zip file with the files for the outlook webpart.  I have not done any thing with these files as of yet.

Thanks again,
-J

  Vickey F replied to Jason
11-Aug-11 12:15 AM
SharePoint makes it very easy to export Calendars from SharePoint to Outlook.

in Outlook 2007-
  • Create the new calendar in sharepoint, and link it to your Outlook
  • Open the source Outlook calendar (either from exchange or as a PST, however you have it).
  • Go to folder view and open the source calendar
  • With the source calendar open, go to view menu, current view, and select all appointments.
  • Hit CTRL-A to select all the appointments, or just get the ones you want.
  • Drag-and-drop the selected calendar Items to the linked sharepoint calendar
  • DONE
  •  

    in Outlook 2003

    or Outlook 2003 Users:

    1. Create a new calendar list on your SharePoint site.  You can do this by clicking Site Actions > View all Site Content  then…
      Import Outlook Calendar Step 1
      click Create And select Calendar

      Import Outlook Calendar Step 1a
    2. Now that our blank calendar is created we can now work on getting the items imported… which is the objective of this article: Open your Microsoft Outlook Calendar and copy the Public Folder by (a.) right-clicking on the Calendar Icon and (b.) copying it into a new folder called “Calendar Copy” located in your mailbox folders (you will have to create this folder before copying). Import Outlook Calendar Step 2Import Outlook Calendar Step 2b
      Above: Depending on how old the Calendar and its size it could take 2-20 minutes to copy. 
    3. Now in a nutshell it’s time to export your Outlook Calendar into a Excel file format with the following columns:
      • Subject
      • Location
      • Start Date
      • Start Time
      • End Date
      • End Time
      • All Day event
    4. We can do this by selecting the “Calendar copy” folder that we just created and clicking File > Import and Export…


      Import Outlook Calendar Step 3
      This will bring up the Wizard view 1.  Select Export to a fileImport Outlook Calendar Step 3b
      Now select Microsoft Excel 97-2003Import Outlook Calendar Step 3c
      Select the location you wish to save the file.Import Outlook Calendar Step 3d
      This will bring up the date range configuration popup.  
      Select the appropriate dates.

      Select the appropriate dates
      Confirm the actions and finish the Wizard.Import Outlook Calendar Step 3f
      If you need more help please check out the following Microsoft Help about Microsoft Outlook Import and Export.
    5. Now that your data is in the Excel file let’s open it up and see what’s in there.  At this point you will notice the Start Date and End Date are in two separate columns.   Now before we do anything to this data we will need to go back to the blank Calendar list in SharePoint and switch to All Event View.  You can do this by entering the list and clicking Modify View > All Events ViewImport Outlook Calendar Step 4
    6. Export this empty view to a Excel Spreadsheet and open it.  You can do this by clicking Actions > Export to Spreadsheet


      Import Outlook Calendar Step 5
    7. Open this exported Outlook Calendar, merge Start Day and Start Time to a single column.  I’m not going to get into the detailed specifics of how to merge these columns as it may differ for individual users, but… In a high-level overview how to merge the columns you can use a formula similar to:

      =CONCATENATE(B:B,” “,C:C) or =CONCATENATE(D:D,” “,E:E) for a blank column in the same workbook to merge 2 column’s data. 

      The “B:B” is the column containing the Start date, the ” ” adds a space, and the “C:C” is the End Date.  If your data is in another you must column change the letters correspond to the appropriate column. Import Outlook Calendar Step 6
      Above: In the image above you can see column M and N hold both Start/End date and times.
    8. Merge End Date and End Time to another single column. Both of these two column should have two spaces between date and time and YY as year, not YYYY or 4 digits.
    9. Copy all Subjects from the exported Calendar to Title column of the Calendar list. The rest are straight forward. Do not put anything to WorkSpace column since it’s read-only.
    10. Correct any errors if you have any and please post them within this article’s comment for a solution. Then sync this list to the SharePoint calendar.

    Final Result:
    Import Outlook Calendar Step 7
    All items from Outlook are now on our new Calendar.

     

    Related posts:

    1. How to Move SharePoint Calendars Fast Moving a calendar list between site collections may be confusing, but it is actually very simple! This article demonstrates one method using list templates and Windows Explorer to move SharePoint Calendars fast.  Don’t worry, all your content will be moved also.  Let’s begin: You must have proper permissions between the two site collections to perform [...]...
    2. SharePoint Data View Web Part Announcements List The frontpage of any corporate Intranet should have announcements to provide site users with up to date information about the on goings of the company. SharePoint provides a number of options to make this possible. The following article will provide you with information about how to use the Data View Web Part to display an [...]...
    3. Custom SharePoint List Icons Recently I was asked by my manager to create a dashboard for executive members to quickly see the progress of active projects. She explained to me that she wanted a “priority level” indicator similar to that of the KPI in a basic table structure. The color of the indicator would change depending on the status [...]...
    4. SharePoint Calendars: Remove the time for calendar items The ITS department created a new calendar dashboard and were delighted that they could finally discontinue the Outlook Public Folder Calendars that were previously in use. There was though one request that is completely understandable: “Please remove the ’12:00 AM and 11:59 PM’ values for the Start Time and End Time and instead just make [...]...
    5. How to remove the “title” column from a SharePoint list Have you asked yourself the question: How do I remove the ‘title column’ from a Sharepoint list?  It can be annoying trying to figure out how to remove this column from default lists.  Often, site admins want their audiences to click on “New Item” in a Sharepoint list and not have to fill out the [...]...


    Follow this link-
    http://www.dlocc.com/articles/import-outlook-calendar-to-sharepoint/

    Hope this will help you.

    Follow this link-Hope this will help you.
      Jason replied to Jason
    12-Aug-11 11:04 AM

    Hi Vickey,

     

    Thank you kindly for taking the time in responding to my inquiry

    and for providing your solution for linking a calendar from SharePoint

    to an end users calendar within Outlook.

     

    The objective that I am working towards involves external end users

    to our organization being able to select an appropriate option from

    a list of training dates (within an online form created with InfoPath).

     

    The goal is to have SharePoint do 4 things (some of these items will

    be taken care of through the use of workflows such as email notifications):

     

    1. SharePoint saves the information from the form into a SharePoint list

    so that our Training Department will be able to effectively manage

    the registrants for the scheduled training dates

     

    2. SharePoint schedules the training date within the end user’s calendar

    (regardless if they are users of Outlook or not) – I am

    exploring iCalendar for non-Outlook users to see if this functionality

    is even an option

     

    3. SharePoint sends out a confirmation email thanking the

    end user for registering for the training session

    4. SharePoint sends out a training reminder email prior to

    the scheduled training date (i.e. 48 hours prior)

     

    One of the problems we currently face is that because the end

    users are external to our organization quite often individuals will

    miss the scheduled training dates.  Some of the reasons include

    the end user forgetting or not manually scheduling the training

    date within their own calendar.  Also, I should indicate that

    the majority of these end users are non-technical in regards

    to SharePoint so the solution has to be simple.

     

    Here is a screen shot of the process flow I have designed

    however if you would like a copy of it, I'd be more than

    happy to email it to whoever would like to see it.

     

     

     

    Any thoughts would be appreciated and I’d be happy to work on a solution as

    I do feel that it is possible to create one.

     

    Thanks,

    Jason

    Create New Account
    help
    Publishing Excel, Infopath Form SharePoint hi , I started working on sharepoint and its related products from last month.I learned some what, the interface which is given in Sharepoint. Microsoft Excel 2007 has the option to publish the Excel to the sharepoint server for collaberation and for some WEb Access. Microsoft Infopath has the option to publish
    the right permissions on the content type. Then, I created a column "external data" in Sharepoint that I linked to my content type. When I want to change the data in EventID Level Message Correlation 11 / 13 / 2011 00:08:30.31 w3wp.exe (0x1D9C) 0x1038 SharePoint Foundation Monitoring nasq Medium Entering monitored scope (Request (GET:http: / / tricoflex:80 / CRM / _layouts / FldNewEx Cust%2E%20Relation%20ID&DescriptionParam = &VldFormulaParam = &VldMessageParam = )) 11 / 13 / 2011 00:08:30.31 w3wp.exe (0x1D9C) 0x1038 SharePoint Foundation Logging Correlation Data xmnv Medium Name = Request (GET:http: / / tricoflex:80 / CRM / _layouts / FldNewEx e307-4c5d-b470-c4351e5dff53 11 / 13 / 2011 00:08:30.32 w3wp.exe (0x1D9C) 0x1038 SharePoint Foundation Logging Correlation Data xmnv Medium Site = / 9694064f-e307-4c5d-b470-c4351e5dff53 11 / 13 / 2011 00:08:30.35 w3wp.exe (0x1D9C) 0x1038 SharePoint Foundation Monitoring b4ly Medium Leaving Monitored Scope (Request (GET:http: / / tricoflex:80 / CRM / _layouts / FldNewEx e307-4c5d-b470-c4351e5dff53 11 / 13 / 2011 00:08:30.45 wsstracing.exe (0x06A0) 0x17A0 SharePoint Foundation Unified Logging Service b9wt High Log retention limit reached. Log file 'C: \ Program Files \ Common Files \ Microsoft Shared \ Web Server Extensions \ 14 \ LOGS \ TRICOFLEX-20111030-0008.log' has been deleted. 11 / 13 2011 00:08:30.45 wsstracing.exe (0x06A0) 0x17A0 SharePoint Foundation Tracing Controller Service 8096 Information Usage log retention limit reached. Some old usage log
    Setup MS Office SharePoint 2007 Test / Dev Environment Authentication Problems Hello all, i like to setup a fast clonable has dsiplay some warning, regarding the installation of MSSQL on a Domain Controller. My single SharePoint admin account is named SPAdmin (domain admin, mssql: security, dbcreator), the local domain ist named mistake, but currently I am reading the logfiles placed under "c: \ program files \ common files \ microsoft shared \ web server extensions \ 12 \ logs". I don't find any relavant information regarding authentication EXE, onetnative.dll) 03 / 04 / 2010 13:53:04.95 OWSTIMER.EXE (0x0980) 0x0988 Windows SharePoint Services Topology 0 Medium Diagnostics settings: 32768 03 / 04 / 2010 13:53:05.38 OWSTIMER.EXE (0x0980) 0x0988 Windows SharePoint Services Topology 9e7d Medium Initializing the configuration database connection. 03 / 04 / 2010 13:53:11 35 OWSTIMER.EXE (0x0980) 0x0988 Windows SharePoint Services Database 880i High System.Data.SqlClient.SqlException: Die von der Anmeldung angeforderte 'SharePoint_07_Config'-Datenbank ServerInfo serverInfo, Strin. . . 03 / 04 / 2010 13:53:11.35* OWSTIMER.EXE (0x0980) 0x0988 Windows SharePoint Services Database 880i High . . .g newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject) bei System.Data SqlClient.SqlConnectionFactory.CreateConn. . . 03 / 04 / 2010 13:53:11.35* OWSTIMER.EXE (0x0980) 0x0988 Windows SharePoint Services Database 880i High . . .ection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) bei System
    Unable to cast COM object of type 'Microsoft.SharePoint.Library.SP SharePoint I periodically get the following error message on a page that displays devexpress charts and such based off of a search result: Unable to cast COM object of type 'Microsoft.SharePoint.Library.SPRequestInternalClass' to interface type Microsoft.SharePoint.Library.ISPRequest'. This operation failed because the QueryInterface call on the COM component for the to the following error: Bad variable type. (Exception from HRESULT: 0x80020008 (DISP_E_BADVARTYPE)). Stack Trace: at Microsoft.SharePoint.Library.SPRequestInternalClass.GetWebAncestry(String bstrUrl) at Microsoft.SharePoint.Library.SPRequest.GetWebAncestry(String bstrUrl) at
    Microsoft.Office.Interop.Excel Hi, I am using Microsoft.Office.Interop.Excel to export the System.data Datatable values to the MS Excel. using Excel = Microsoft.Office.Interop.Excel; Excel.Application App = null; Excel._Workbook WB = null; Excel._Worksheet WS = null; / / Start Excel and