I have a requirement where I have to update list item in a list fetching values from an e-mail. I have to create a button in the outlook ribbon, clicking on which the values (in key-value pair) should be stored in the sharepoint 2013 list. Cannot use server side coding. It has to be done by client side.
-
What do you mean by button in outlook ribbon? explain please– akbar aliCommented Jan 19, 2017 at 12:23
-
you can use an email address where you can send email and it will go to the list after some configuration. Is this what you want?– akbar aliCommented Jan 19, 2017 at 12:26
-
First, I want to create a button on outlook ribbon, something like save in sharepoint list. I am planning to do it via Office Add-Ins --> Outlook Add-In. Second, on that button click, it should read the email (which will be received in key-value pair) and update it on sharepoint list.– Mayank SrivastavaCommented Jan 19, 2017 at 12:29
Add a comment
|
1 Answer
Create an Outlook Add-In with Visual Studio (C#). Then add SharePoint Client References and CSOM Code to your Add-In Project.
using System;
using Microsoft.SharePoint.Client;
using SP = Microsoft.SharePoint.Client;
namespace Microsoft.SDK.SharePointServices.Samples
{
class CreateListItem
{
static void Main()
{
string siteUrl = "http://MyServer/sites/MySiteCollection";
ClientContext clientContext = new ClientContext(siteUrl);
SP.List oList = clientContext.Web.Lists.GetByTitle("Announcements");
ListItemCreationInformation itemCreateInfo = new ListItemCreationInformation();
ListItem oListItem = oList.AddItem(itemCreateInfo);
oListItem["Title"] = "My New Item!";
oListItem["Body"] = "Hello World!";
oListItem.Update();
clientContext.ExecuteQuery();
}
}
}
References
Outlook Addin:
https://msdn.microsoft.com/en-us/library/cc668191.aspx
CSOM Create List Item
https://msdn.microsoft.com/en-us/library/office/ee539976(v=office.14).aspx