Elczar Adame's Shared Points on SharePoint

Posts tagged ‘SharePoint 2010’

Developing SharePoint CustomAction for SharePoint Online in Office365

Are you tasked to create a link, or know as CustomAction,  on the Site Settings page of a SharePoint Online site in Office365? Nothing to worry! The following steps would provide you a guidance.

1. Initially, using Microsoft Visual Studio 2010, let us create an Empty SharePoint Project. In this demonstration, we will name it Office365.

Capture 1

2. As illustrated below, we need to create a Sandboxed solution. SharePoint Online tenancy in Office 365 only supports Sandboxed solutions.

Capture 2

3. Now we will create an Empty Element. In this demonstration, we will name it CustomAction.

Capture 3

4. Let open the Element.xml file we have just created and write the following code. MSDN, at http://msdn.microsoft.com/en-us/library/ms460194.aspx,  has provided us a comprehensive description of every attribute below.

Moreover, the list of Custom Action Location and IDs are available at http://msdn.microsoft.com/en-us/library/bb802730.aspx.

Of course, using Microsoft Visual Studio 2010, we need to package our solution.

Capture 4

5. At this point, let us open the Site Settings page of our SharePoint Online in Office365. As highlighted below, let us open our Solutions page.

Capture 5

6. On the Solutions page, let us download the WSP file of the solution we have just created.

Capture 6

7. Now, let us open the Manage Site Features link.

Capture 7

8. On the Features page, let us activate the feature we have just uploaded.

Since, I have changed some of the default values of the solution we have created (the changes I have made are not essential and I have not included them in this demonstration), you might have a different feature name, icon, and description in your implementation.

Capture 8

9. Upon successfully activating the feature we have created, we could now enjoy the presence of a custom action link on the Site Settings page of our SharePoint Online in Office365.

Capture 9

For more information on SharePoint Online Programming for Office365, please visit http://msdn.microsoft.com/en-us/library/hh147180.aspx.

Digg This

SharePoint List Items in a Silverlight DataGrid

Do you have a requirement to bring your SharePoint list items in a Silverlight datagrid? The sample code below might help you.

 1: String listname = "YourCustomList";
 2: String webfullurl = "http://yourspsite/";
 3: ClientContext clientcontext;
 4: ListItemCollection listitemcollection;
 6: private void GetItems(string Status)
 7: {
 8:    using (ClientContext clientcontext = new 
 9:    {
 10:       Web web = clientcontext.Web;
 11:       ListCollection listcollection = web.Lists;
 12:       List list = clientcontext.Web.Lists.GetByTitle
 13:       clientcontext.Load(list);
 15:       CamlQuery camlquery = new CamlQuery();
 16:       camlquery.ViewXml = "<View><Query><OrderBy>
<FieldRef Name='Title'/></OrderBy></Query></View>";
 17:       listitemcollection = list.GetItems(camlquery);
 18:       clientcontext.Load(listitemcollection);
 20:       clientcontext.ExecuteQueryAsync
(OnQuerySucceeded, OnQueryFailed);
 21:    }
 22: }
 24: private void OnQuerySucceeded(object sender, 
ClientRequestSucceededEventArgs args)
 25: {
 26:    UpdateUserInterface updateuserinterface = 
 27:    this.Dispatcher.BeginInvoke(updateuserinterface);
 28: }
 30: private void FillDataGrid()
 31: {
 32:    List<YourListItems> yourlistitems = new 
 33:    foreach (ListItem listitem in listitemcollection)
 34:    {
 35:       yourlistitems.Add(new YourListItem()
 36:       {
 37:          Title = listitem["Title"].ToString()
 38:        });
 39:    }
 41:    GridOpenPositions.ItemsSource = yourlistitems;
 42: }
 44: private void OnQueryFailed(object sender, 
ClientRequestFailedEventArgs args)
 45: {
 46:    HtmlPage.Window.Alert("Request failed. " + 
args.Message + "\n" + args.StackTrace);
 47: }
 49: private delegate void UpdateUserInterface();
 51: public class YourListItems
 52: {
 53:    public string Title { get; set; }
 54: }
Digg This

Tag Cloud