Share Point 2010 Developer Walk Through Guide

  • Published on
    02-Oct-2014

  • View
    288

  • Download
    2

Embed Size (px)

Transcript

<p> . , , URL- - , . , , . , , . . - . . (Microsoft Corporation), 2010. . Microsoft, SharePoint, Visual Studio, InfoPath Visio . .</p> <p> 1</p> <p> SharePoint 2010</p> <p> 1. - Linq ......................................... 4 1. SharePoint ............................................................................................ 4 2. - LINQ-to-SharePoint ....................... 7 3. SharePoint - ........................................... 10 4. - ................................................................ 12 2. BCS ............................................................................. 17 1. - ................................................................. 17 2. ........................................................................................ 18 3. ............................................................................................................ 29 4. ...................................................................................................... 31 3. Silverlight SharePoint ............... 35 1. Silverlight ................................................................................... 35 2. SharePoint ................. 37 3. - SharePoint Silverlight ........................................ 41 4. SharePoint Silverlight ......................................................................................................................................... 43 1. Silverlight ................................................................................... 43 2. Employee SharePoint Silverlight Graph ........................................................................................................ 47 3. - SharePoint Silverlight .................................................................................................................................................. 50 5. - .............................................................. 54 1. - ...................................................... 54 2. , .................................................. 56 3. .......................................................... 59 6. SharePoint .... 64 1. ................................................................................................... 64 2. , ............................................................................................................................ 66 3. , , ................................................................................................................................. 68 4. . ..................................................................................... 71 5. SPDActivityDemo, SPCHOL305Ex1. ............................................................................................................................................. 76 6. ................................................ 78 7. .................................................................................. 78 8. SharePoint ....................................................................................................................................................... 79 9. Visual Studio ........................... 87 10. SharePoint ................................................. 94 ................................................................................................................ 97</p> <p> 2</p> <p> SharePoint 2010</p> <p> , C#, Visual Studio 2010 SharePoint 2010. , , . eLearning: http://msdn.microsoft.com/ru-ru/sharepoint/ee513148.aspx (, ). , , , , C#, VB.NET. sp2010fb@Microsoft.com.</p> <p> 3</p> <p> SharePoint 2010</p> <p> 1. - Linq : 10 -, DataGrid. : 1. -. 2. - Linq. 3. Linq SharePoint. 4. - SPDataGrid. 1. SharePoint . 1 . 1. Visual Studio 2010, | | Microsoft Visual Studio 2010 | Microsoft Visual Studio 2010. 2. | | . 3. Visual C# | SharePoint | 2010. 4. -.</p> <p> 4</p> <p> SharePoint 2010</p> <p> 1. - SharePoint 2010</p> <p>5. SPCHOL200-Ex1. 6. C:\SPHOLS\SPCHOL200\CS\Ex1. 7. . 8. OK. 9. SharePoint . http://intranet.contoso.com/ . . .</p> <p> 5</p> <p> SharePoint 2010</p> <p> 2. SharePoint</p> <p>10. Visual Studio SPCHOL200-Ex1 .</p> <p> 3. SPCHOL200-Ex1</p> <p> 6</p> <p> SharePoint 2010</p> <p>11. , Visual Studio - VisualWebPart1. VisualWebPart1 VisualWebPart1.webpart.</p> <p> 4. -</p> <p>12. Title SPLinqDemoTitle, Description SPLinqDemoPart Description. Title Description - . . SPLinqDemoTitle SPLinqDemoPart Description </p> <p> 2. - LINQ-to-SharePoint spmetal.exe - Linq-to-SharePoint. 1. SPCHOL200-Ex1 Windows. 2. Shift - , , :</p> <p> 7</p> <p> SharePoint 2010</p> <p> 5. </p> <p>3. , SharePoint 2010: set path=%path%;c:\program files\common files\microsoft shared\web server extensions\14\bin 4. , - Linq-to-SharePoint:spmetal.exe /web:http://intranet.contoso.com /namespace:SPCHOL200_Ex1.VisualWebPart1 /code:SPLinq.cs</p> <p>. . . 5. Visual Studio. 6. Visual Studio SPCHOL200-Ex1 | .</p> <p> 6. </p> <p>7. SPLinq.cs :</p> <p> 8</p> <p> SharePoint 2010</p> <p> 7. SPLinq.cs</p> <p>8. . 9. C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\ISAPI . , . , 8. 10. Microsoft.SharePoint.Linq.dll.</p> <p> 9</p> <p> SharePoint 2010</p> <p> 8. </p> <p>11. OK, . 3. SharePoint - , - SharePoint. 1. VisualWebPart1 VisualWebPart1UserControl.ascx. 2. Visual Studio Visual Web Part. 3. , .</p> <p> 10</p> <p> SharePoint 2010</p> <p> : ASP.NET | spchol200_ex1_spgridview 4. Visual Web Part :</p> <p> 9. Visual Web Part</p> <p>5. VisualWebPart1UserControl.ascx . 6. using :using Microsoft.SharePoint.Linq; using Microsoft.SharePoint; using System.Linq;</p> <p> : My Code Snippets | spchol200_ex1_namespaces 7. Page_Load :var dc = new SPLinqDataContext(SPContext.Current.Web.Url); var Employees = dc.GetList("Employees");</p> <p> 11</p> <p> SharePoint 2010</p> <p>var empQuery = from emp in Employees where emp.Project.DueDate &lt; DateTime.Now.AddMonths(6) select new { emp.Title, emp.JobTitle, ProjectTitle = emp.Project.Title, DueDate = emp.Project.DueDate.Value.ToShortDateString() }; spGridView.DataSource = empQuery; spGridView.DataBind();</p> <p> : My Code Snippets | spchol200_ex1_pageload 4. - 1. SPCHOL200-Ex1 . - SharePoint: http://intranet.contoso.com</p> <p> 10. -</p> <p>2. Internet Explorer : http://intranet.contoso.com 3. , . : Administrator : pass@word1 4. , SharePoint .</p> <p> 12</p> <p> SharePoint 2010</p> <p> 11. SharePoint</p> <p> 12. SharePoint </p> <p>5. -, - .</p> <p> 13</p> <p> SharePoint 2010</p> <p> 13. SharePoint -</p> <p>6. . 7. - - SPLinqDemoTitle.</p> <p> 14. - SPlinqDemoTitle</p> <p> , -. , -. </p> <p> 14</p> <p> SharePoint 2010</p> <p>.</p> <p> 15. </p> <p>8. , - . - SPLinqDemoTitle .</p> <p> 15</p> <p> SharePoint 2010</p> <p> 16. - SPLinqDemoTitle </p> <p>9. , , , . .</p> <p> 17. SharePoint </p> <p>10. Internet Explorer. 11. Visual Studio 2010. , Linq to SharePoint SharePoint. 16</p> <p> SharePoint 2010</p> <p> 2. BCS - Visual Studio 2010 . 1. - 1. Visual Studio 2010, | | Microsoft Visual Studio 2010 | Microsoft Visual Studio 2010; | | . 2. Visual C# | SharePoint | 2010 |, -. 3. BDCEx1.</p> <p> 18. </p> <p>4. C:\SPHOLS\SPCHOL304\CS\Ex1. 5. OK.</p> <p> 17</p> <p> SharePoint 2010</p> <p>6. URL- http://intranet.contoso.com. 7. .</p> <p> 19. SharePoint</p> <p>8. . 2. 1. | . , Entity1.cs Customer.cs, Entity1Service.cs CustomerService.cs. :</p> <p> 18</p> <p> SharePoint 2010</p> <p> 20. Visual Studio</p> <p>2. Customer.cs, . Customer . , -. , Identifier1 CustomerId , , Identifier1. , .</p> <p>public public public public</p> <p>Int32 CustomerId { get; set; } string Message { get; set; } string FirstName { get; set; } string LastName { get; set; }</p> <p> : My Code Snippets | spchol304_ex1_customer</p> <p> 21. Customer </p> <p> 19</p> <p> SharePoint 2010</p> <p> 3. BCS 1. BdcModel1.bdcm, - .</p> <p> 22. , BDCModel1.bdcm -.</p> <p>2. Entity1, .</p> <p> 23. Entity1</p> <p>3. Entity1 Customer, Entity1 F2 ( ). 4. Identifier1 F4, . Identifier1 CustomerId System.Int32.</p> <p> 20</p> <p> SharePoint 2010</p> <p> 24. </p> <p>5. - Visual Studio | BDCModel1 | BDCModel1 | Customer | ReadList | returnParameter. Entity1List, .</p> <p> 25. - Entity1List</p> <p>6. Entity1List CustomerList.</p> <p> 21</p> <p> SharePoint 2010</p> <p>7. - CustomerList.</p> <p> 26. - Entity1</p> <p>8. Entity1 Customer. - Customer Identifier1 CustomerId TypeName System.Int32.</p> <p> 22</p> <p> SharePoint 2010</p> <p> 27. Identifier1</p> <p>9. - Customer .</p> <p> 28. Customer</p> <p>10. TypeDescriptor Name FirstName. 11. - Customer . 12. TypeDescriptor Name LastName.</p> <p> 29. Customer - FirstName LastName</p> <p>13. - Customer .</p> <p> 30. Customer</p> <p>14. - ReadItem, returnParameter .</p> <p> 23</p> <p> SharePoint 2010</p> <p> 31. returnParameter</p> <p>15. .</p> <p> 32. </p> <p>16. returnParameter | Customer , FirstName LastName .</p> <p> 24</p> <p> SharePoint 2010</p> <p> 33. - , 1- 18- 1</p> <p> 25</p> <p> SharePoint 2010</p> <p>17. - ReadItem | id Identifier1. 18. Identifier1 CustomerId TypeName System.Int32.</p> <p> 34. Identifier1</p> <p>19. - </p> <p> 35. -</p> <p> 26</p> <p> SharePoint 2010</p> <p>20. id</p> <p> 36. id </p> <p> 27</p> <p> SharePoint 2010</p> <p>21. . 22. @id ReadItem, CustomerId, @id Update. 23. Pre-Updater id, True.</p> <p> 37. Pre-Updater True</p> <p> 28</p> <p> SharePoint 2010</p> <p> 3. 1. CustomerService.cs. 2. CustomerService . , .</p> <p>public static Dictionary d = null; public static Customer ReadItem(Int32 id) { // take a copy for SharePoint Customer c = new Customer(); Customer e = d[id]; c.CustomerId = e.CustomerId; c.FirstName = e.FirstName; c.LastName = e.LastName; c.Message = e.Message; return c; } public static IEnumerable ReadList() { // this is usually the first method called so check for null if (d == null) { d = new Dictionary(); for (int i = 0; i &lt; 10; i++) { Customer e = new Customer(); e.CustomerId = i; e.Message = i + " Item Data"; e.FirstName = i + " First Name"; e.LastName = i + " Last Name"; d.Add(i, e); } } return d.Values; } public static void Update(Customer customer, Int32 id) { d[id].FirstName = customer.FirstName; d[id].LastName = customer.LastName; d[id].Message = customer.Message; }</p> <p> : My Code Snippets | spchol304_ex1_customerservice 29</p> <p> SharePoint 2010</p> <p> 38. CustomerService </p> <p>3. Features Feature1.feature. . 4. . 5. + , . 6. (Property) URL- .</p> <p> 30</p> <p> SharePoint 2010</p> <p> 39.</p> <p> 39. SiteUrl</p> <p> 4. 1. | BDCEx1. 2. http://intranet.contoso.com . 3. </p> <p> 40. </p> <p>4. .</p> <p> 41. </p> <p> 31</p> <p> SharePoint 2010</p> <p> External List .</p> <p> 42. </p> <p>5. . 6. ( ).</p> <p> 43. </p> <p> 32</p> <p> SharePoint 2010</p> <p>7. BDCEx1.BDCModel1.Customer OK.</p> <p> 44. - -</p> <p> 45. </p> <p> 33</p> <p> SharePoint 2010</p> <p>8. . 9. .</p> <p> 46. ( -)</p> <p> 34</p> <p> SharePoint 2010</p> <p> 3. Silverlight SharePoint Silverlight, SharePoint . , Silverlight SharePoint. Visual Studio 2010, SharePoint. 1. Silverlight Silverlight. 1. Visual Studio 2010, | | Microsoft Visual Studio 2010 | Microsoft Visual Studio 2010. 2. | | . 3. | Visual Studio | . 4. .NET Framework 3.5 5. Begin. 6. C:\SPHOLS\SPCHOL306\CS\Ex1\.</p> <p> 47. </p> <p> 35</p> <p> SharePoint 2010</p> <p>7. OK, . 8. | | . 9. Visual C# | Silverlight, Silverlight . 10. .NET Framework 3.5 11. SPSilverlightExample. 12. .</p> <p> 48. </p> <p>13. OK, .</p> <p> 49. Silverlight</p> <p> 36</p> <p> SharePoint 2010</p> <p>14. OK, . 15. SPSilverlightExample SharePoint Silverlight. SPSilverlightExample . 16. C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS\ClientBin. 17. Microsoft.SharePoint.ClientSilverlight.dll Microsoft.SharePoint.Client.Silverlight.Runtime.dll ( CTRL, ). 18. OK, DLL.</p> <p> 50. </p> <p> 2. SharePoint 1. Visual Studio Silverlight. 2. DataGrid Silverlight Page.xaml.</p> <p> 37</p> <p> SharePoint 2010</p> <p> 51. Silverlight</p> <p>3. DataGrid , , Width Height Auto, HoriztonalAlignment VerticalAlignment Stretch, Margin 0.</p> <p> 52. DataGrid</p> <p> 38</p> <p> SharePoint 2010</p> <p>4. AutoGenerateColumns ( XAML true).</p> <p> 53. AutoGenerateColumns</p> <p>5. App.xaml.cs using:using Microsoft.SharePoint.Client; using System.Threading;</p> <p> : My Code Snippets | spchol306_ex1_app_namespaces 6. Application_Startup.ApplicationContext.Init(e.InitParams, SynchronizationContext.Current);</p> <p> : My Code Snippets | spchol306_ex1_ application_startup 7. MainPage.xaml.cs using:using Microsoft.SharePoint.Client;</p> <p> : My Code Snippets | spchol306_ex1_page_namespaces 8. MainPage :public class Project { public string Title { get; set; } public DateTime DueDate { get; set; } public string Description { get; set; } }</p> <p> : My Code Snippets | spchol306_ex1_ classes 9. MainPage :private ListItemCollection _projects;</p> <p> : My Code Snippets | spchol306_ex1_ property 10. Page InitializeComponent:</p> <p> 39</p> <p> SharePoint 2010</p> <p>ClientContext context = new ClientContext(ApplicationContext.Current.Url); context.Load(context.Web); List Projects = context.Web.Lists.GetByTitle("Projects"); context.Load(Projects); CamlQuery query = new Microsoft.SharePoint.Client.CamlQuery(); string camlQueryXml = "" + "" + "2008-01-1T00:00:00Z" + "" + "" + "" + ""; query.ViewXml = camlQueryXml; _projects = Projects.GetItems(query); context.Load(_projects); context.ExecuteQueryAsync(new ClientRequestSucceededEventHandler(OnRequestSucceeded), null);</p> <p> : My Code Snippets | spchol306_ex1_initializecomponent 11. :private void OnRequestSucceeded(Object sender, ClientRequestSucceededEventArgs args) { // this is not called on the UI thread Dispatcher.BeginInvoke(BindData); } private void BindData() { List projects = new List(); foreach (ListItem li in _projects) { projects.Add(n...</p>