Your SlideShare is downloading. ×
Custom SharePoint 2010 solutions without server access
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Custom SharePoint 2010 solutions without server access

3,815
views

Published on

Published in: Technology

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
3,815
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
4
Comments
0
Likes
1
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Developing Custom SharePoint 2010 Solutions without server access
    Phil Wicklund
    SharePoint FREEWARE
    www.PhilWicklund.com
    SharePoint CONSULTING
    www.RBAconsulting.com
  • 2. About Me…
    Working with SP since 2004
    Started as a trainer for Mindsharp
    Now consulting through RBA in MN
    Blog: philwicklund.com
    Writing a 2010 book:
  • 3. Agenda
    The Problem: how to develop custom
    solutions that won’t impair the farm
    SharePoint Designer 2010
    Sandboxed Solutions
    Client Object Model
    Questions
    SharePoint FREEWARE
    www.PhilWicklund.com
    SharePoint CONSULTING
    www.RBAconsulting.com
  • 4. SharePoint Designer 2010
    Used for:
    Browser alternative (administrate pages, content types, web parts, etc)
    Branding
    XsltListViewWebPart
    Workflow
    External Data
    SharePoint FREEWARE
    www.PhilWicklund.com
    SharePoint CONSULTING
    www.RBAconsulting.com
  • 5. Demo 1: Workflow with SPD
    Model Workflow in Office Visio
    Import Workflow into SharePoint Designer
    Publish to SharePoint, and test
    SharePoint FREEWARE
    www.PhilWicklund.com
    SharePoint CONSULTING
    www.RBAConsulting.com
  • 6. Sandboxed Solutions
    Solutions are cab based file with wspextenion
    can contain web parts, features, workflows, etc.
    Scoped to a Site Collection
    Site Collection Administrators Install, Manage and Monitor the solutions
    SharePoint FREEWARE
    www.PhilWicklund.com
    SharePoint CONSULTING
    www.RBAconsulting.com
  • 7. Sandboxed Solutions
    Solution Gallery:
    SharePoint FREEWARE
    www.PhilWicklund.com
    SharePoint CONSULTING
    www.RBAconsulting.com
  • 8. Sandboxed Solutions
    Debugging Sandboxed Solutions
    Farm Solutions run in the w3wp.exe process
    Sandboxed Solutions run in the SPUCWorkerProcess.exe process
    Hitting F5 automatically attaches to SPUCWorkerProcess.exe, then simply drop web part on a page, for example
    SharePoint FREEWARE
    www.PhilWicklund.com
    SharePoint CONSULTING
    www.RBAconsulting.com
  • 9. Sandboxed Solutions
    Caveats
    Full API swapped out at runtime with sandboxed subset. SPSecurity.RunWithElevatedPrivledges, for example, won’t work.
    IntelliSense is also truncated to help prevent runtime errors since compiler compiles against full API
    Try to avoid cut and paste
    All classes below SPSite are available
    Partial trust prevents access to anything outside the scope of the Site Collection (Internet, Web service, file system, etc)
    SharePoint FREEWARE
    www.PhilWicklund.com
    SharePoint CONSULTING
    www.RBAconsulting.com
  • 10. Sandboxed Solutions
    Monitoring
    “Point” quotas set in Central Administration. Default is 300 points.
    Shows usage reports, for today and a 14 day average
    Points – next slide
    Validators
    Fire on upload of solution into Gallery
    Can enfore, only web parts, singed cod with a particular token, log/catalog solutions, etc.
    SharePoint FREEWARE
    www.PhilWicklund.com
    SharePoint CONSULTING
    www.RBAconsulting.com
  • 11. Sandboxed Solutions
    Courtesy John W Powell - MSDN
  • 12. Demo 2: Sandboxed Web Part
    New Visual Studio Project
    Create a Web Part
    Deploy as Sandboxed Solution
    SharePoint FREEWARE
    www.PhilWicklund.com
    SharePoint CONSULTING
    www.RBAConsulting.com
  • 13. Client Side Object Model
    Not enough web services in SP 2007
    Rather than create more services, COM provides the complete API
    COM provides a consistent development experience:
    Windows Applications
    ASP.NET web sites
    Silverlight Applications
    JavaScript, www client side scripting
    SharePoint FREEWARE
    www.PhilWicklund.com
    SharePoint CONSULTING
    www.RBAconsulting.com
  • 14. COM Architecture
    SharePoint FREEWARE
    www.PhilWicklund.com
    SharePoint CONSULTING
    www.RBAconsulting.com
  • 15. Assembly References
    SharePoint, Server Side
    Microsoft.SharePoint (ISAPI)
    .NET clients
    Microsoft.SharePoint.Client (ISAPI)
    Silverlight clients
    Microsoft.SharePoint.Client.Silverlight (Layouts/clientbin)
    Javascript clients
    SP.js & SP.Core.js (Layouts)
    SharePoint FREEWARE
    www.PhilWicklund.com
    SharePoint CONSULTING
    www.RBAconsulting.com
  • 16. Comparable Objects
    SharePoint FREEWARE
    www.PhilWicklund.com
    SharePoint CONSULTING
    www.RBAconsulting.com
  • 17. Starter Code
    Using Microsoft.SharePoint.Client;
    ...
    using (ClientContext context = new ClientContext("http://intranet"))
    {
    Web web = context.Web;
    context.Load(web);
    context.ExecuteQuery();
    string title = web.Title;
    // ListCollection lists = web.Lists;
    }
    SharePoint FREEWARE
    www.PhilWicklund.com
    SharePoint CONSULTING
    www.RBAconsulting.com
  • 18. Iterating through Lists in a Web
    using (ClientContext context = new ClientContext("http://intranet"))
    {
    Web web = context.Web;
    context.Load(web);
    context.Load(web.Lists);
    context.ExecuteQuery();
    foreach(List list in web.Lists)
    {
    //do something
    }
    }
    SharePoint FREEWARE
    www.PhilWicklund.com
    SharePoint CONSULTING
    www.RBAconsulting.com
  • 19. Efficiencies… Don’t be Lazy!
    Web web = context.Web;
    context.Load(web, wprop => wprop.Title));
    ListCollection lists = web.Lists;
    IEnumerable<List> filtered = context.
    LoadQuery(lists.Include(l=>l.Title));
    context.ExecuteQuery();
    foreach(List list in filtered)
    { }
    SharePoint FREEWARE
    www.PhilWicklund.com
    SharePoint CONSULTING
    www.RBAconsulting.com
  • 20. Working with List Items
    Web web = context.Web;
    List list = context.Web.Lists.
    GetByTitle(“List Title");
    CamlQuery query = CamlQuery.CreateAllItemsQuery();
    ListItemCollection items = lst.GetItems(query);
    context.Load(items);
    context.ExecuteQuery();
    foreach (ListItem item in items)
    {
    string title = item["Title"];
    }
    SharePoint FREEWARE
    www.PhilWicklund.com
    SharePoint CONSULTING
    www.RBAconsulting.com
  • 21. Efficencies with List Items
    CamlQuery query = new CamlQuery();
    query.ViewXml = "<View><Query><Where><Eq>
    <FieldRef Name='Title'/><Value Type='Text'>Phil</Value>
    </Eq></Where></Query></View>";
    ListItemCollection items = list.GetItems(query);
    context.Load(items, x => x.Include(
    item => item["ID"],
    item => item["Title"],
    item => item.DisplayName));
    SharePoint FREEWARE
    www.PhilWicklund.com
    SharePoint CONSULTING
    www.RBAconsulting.com
  • 22. Adding new List Items
    List list = context.Web.Lists.
    GetByTitle(“List Title");
    context.Load(list);
    ListItemnewItem = list.AddItem(new ListItemCreationInformation());
    newItem["Title"] = "My new item";
    newItem.Update();
    context.ExecuteQuery();
    SharePoint FREEWARE
    www.PhilWicklund.com
    SharePoint CONSULTING
    www.RBAconsulting.com
  • 23. Silverlight & Asynchronous Calls
    private void Button_Click(object sender, RoutedEventArgs e)
    {
    // Load a bunch of stuff
    clientContext.ExecuteQueryAsync(success, failure);
    }
    private void success(object sender, ClientRequestSucceededEventArgsargs)
    {
    RunQueryrunQuery= Run;
    this.Dispatcher.BeginInvoke(runQuery);
    }
    private delegate void RunQuery();
    private void Run() { /* do something */ }
    private void failure(object sender, ClientRequestFailedEventArgsargs) { /* do something */ }
    SharePoint FREEWARE
    www.PhilWicklund.com
    SharePoint CONSULTING
    www.RBAconsulting.com
  • 24. Demo 3: .NET COM
    Build a Console (client) Application
    Render all theList Titles from a remoteSharePoint site.
    Create a new list itemin a remote SharePointsite.
    SharePoint FREEWARE
    www.PhilWicklund.com
    SharePoint CONSULTING
    www.RBAConsulting.com
  • 25. Questions & Comments
    Phil Wicklund
    SharePoint FREEWARE
    www.PhilWicklund.com
    SharePoint CONSULTING
    www.RBAConsulting.com