{"id":266851,"date":"2015-10-27T10:55:03","date_gmt":"2015-10-27T07:55:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=266851"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=266851","title":{"rendered":"\u0418\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f ASP.NET MVC c Sharepoint 2013. Part 2: \u0412\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 SharePoint"},"content":{"rendered":"<p>       \u0412 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 <a href=\"http:\/\/habrahabr.ru\/company\/docsvision\/blog\/242325\/\/\">\u0418\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f ASP.NET MVC c Sharepoint 2013. Part 1: High-Trusted provider-hosted APP<\/a> \u0431\u044b\u043b\u043e \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043d\u043e, \u043a\u0430\u043a \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c SharePoint 2013 \u0434\u043b\u044f SharePoint Apps (\u0442\u0435\u043f\u0435\u0440\u044c Microsoft \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u044d\u0442\u043e <a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/office\/fp161507.aspx#bk_newname\">SharePoint Add-in<\/a>) \u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0431\u0430\u0437\u043e\u0432\u0443\u044e \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f ASP.NET MVC \u0441 provider-hosted APP. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043f\u043e\u043a\u0430\u0436\u0443, \u043a\u0430\u043a \u043c\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b\u0438: \u043f\u043e\u0438\u0441\u043a \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 SharePoint Site \u0432 MVC \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438, \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0438\u0437 SharePoint Site, App-parts \u0438 \u043b\u043e\u043a\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 SharePoint.<br \/>  <a name=\"habracut\"><\/a><br \/>  <b>\u041f\u043e\u0438\u0441\u043a \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 SharePoint \u0447\u0435\u0440\u0435\u0437 ASP.NET MVC \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435<\/b><\/p>\n<p>  \u0414\u043e\u043f\u0443\u0441\u0442\u0438\u043c, \u0447\u0442\u043e \u0433\u0434\u0435-\u0442\u043e \u0432 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0435 \u0432\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0435\u0441\u0442\u044c \u043e\u0431\u044b\u0447\u043d\u043e\u0435 \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u043e\u0435 \u043f\u043e\u043b\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 action SharepointSearch:  <\/p>\n<pre><code>    public JsonResult SharepointSearch(string search)     {         var sharepointItems = GetSharePointSearchResult(search);         var json = JsonHelper.ConvertToJsonResponse(sharepointItems);          return Json(json);     }      private ResponseModel&lt;List&lt;SharePointDocumentModel&gt;&gt; GetSharePointSearchResult(string query)     {         var responseModel = new ResponseModel&lt;List&lt;SharePointDocumentModel&gt;&gt;();         var searchResult = new List&lt;SharePointDocumentModel&gt;();          var spContext = SharePointContextProvider.Current.GetSharePointContext(HttpContext);          if (spContext == null)         {             responseModel.Initialize(searchResult, Resources.SharepointContextNull, ResponseStatusEnum.Fail);             return responseModel;         }                          using (var clientContext = spContext.CreateUserClientContextForSpHost())         {             clientContext.ExecuteQuery();              var keywordQuery = new KeywordQuery(clientContext);             keywordQuery.QueryText = query;              var searchExecutor = new SearchExecutor(clientContext);              var results = searchExecutor.ExecuteQuery(keywordQuery);             clientContext.ExecuteQuery();             foreach (var resultRow in results.Value[0].ResultRows)             {                 clientContext.ExecuteQuery();                 var spDocument = new SharePointDocumentModel();                 DateTime createdDateTime;                 DateTime.TryParse(GetDictonaryStringValueByKey(resultRow, &quot;Write&quot;), out createdDateTime);                  var contentTypeId = spDocument.DocumentName = GetDictonaryStringValueByKey(resultRow, &quot;ContentTypeId&quot;);                  if (contentTypeId.StartsWith(&quot;0x01&quot;))                 {                     spDocument.DocumentName = GetDictonaryStringValueByKey(resultRow, &quot;Title&quot;);                     spDocument.DocumentUrl = GetDictonaryStringValueByKey(resultRow, &quot;Path&quot;);                     spDocument.Id = GetDictonaryStringValueByKey(resultRow, &quot;WorkId&quot;);                     spDocument.Author = GetDictonaryStringValueByKey(resultRow, &quot;Author&quot;);                                          spDocument.CreateDate = createdDateTime.ToShortDateString();                      searchResult.Add(spDocument);                 }             }         }          responseModel.Initialize(searchResult);          return responseModel;     } <\/code><\/pre>\n<p>  \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0431\u044b\u043b\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432\u0441\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u0441\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 \u043b\u044e\u0431\u044b\u0435 SP-\u043e\u0431\u044a\u0435\u043a\u0442\u044b (\u043f\u043e \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u0443 &quot;<b>0x01<\/b>&quot;). \u041e\u0434\u043d\u0430\u043a\u043e \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0434\u0435\u0442\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0442\u0431\u043e\u0440 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f <a href=\"https:\/\/msdn.microsoft.com\/en-US\/library\/office\/aa543822(v=office.14).aspx\">\u0434\u0440\u0443\u0433\u0438\u0435 \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u0430 SharePoint<\/a><\/p>\n<p>  <b>\u041f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 SharePoint \u0447\u0435\u0440\u0435\u0437 CustomActions<\/b><\/p>\n<p>  \u0427\u0435\u0440\u0435\u0437 SharePoint APP \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u00ab\u0432\u043d\u0435\u0434\u0440\u0438\u0442\u044c\u00bb \u0432 SharePoint \u0441\u0432\u043e\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b CustomActions (\u043a\u043d\u043e\u043f\u043a\u0438 \u0432 \u0440\u0438\u0431\u0431\u043e\u043d\u0435, \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0432 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043d\u043e\u043c \u043c\u0435\u043d\u044e). \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0439 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u044d\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c, \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/office\/jj163954.aspx\">\u043d\u0430 MSDN<\/a>.<br \/>  \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0434\u0432\u0430 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430: \u043a\u043d\u043e\u043f\u043a\u0443 \u0432 \u0440\u0438\u0431\u0431\u043e\u043d \u0438 \u0432 \u043f\u0443\u043d\u043a\u0442 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043d\u043e\u0435 \u043c\u0435\u043d\u044e. <br \/>  \u041d\u0430\u0447\u043d\u0435\u043c \u0441 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043d\u043e\u0433\u043e \u043c\u0435\u043d\u044e. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u043c \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u043d\u0430\u0448 SharePoint APP \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u043e\u0432\u044b\u0439 <b>Menu Item Custom Action<\/b>. \u0412 \u0432\u0438\u0437\u0430\u0440\u0434\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 Visual Studio \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c, \u0433\u0434\u0435 \u0438 \u0432 \u043a\u0430\u043a\u0438\u0445 \u0441\u043f\u0438\u0441\u043a\u0430\u0445 \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u043e\u044f\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u043f\u0443\u043d\u043a\u0442 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043d\u043e\u0433\u043e \u043c\u0435\u043d\u044e. \u0415\u0441\u043b\u0438 \u0432\u0437\u0433\u043b\u044f\u043d\u0443\u0442\u044c \u043d\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442, \u0442\u043e \u0441\u0442\u0430\u043d\u0435\u0442 \u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u044d\u0442\u043e \u043e\u0431\u044b\u0447\u043d\u044b\u0439 xml \u0444\u0430\u0439\u043b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u044f:  <\/p>\n<pre><code class=\"xml\">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;Elements xmlns=&quot;http:\/\/schemas.microsoft.com\/sharepoint\/&quot;&gt;   &lt;CustomAction Id=&quot;6d471c89-41cc-4b81-b794-ea7664dc4c38.AttachToNewDocument&quot;                 RegistrationType=&quot;ContentType&quot;                 RegistrationId=&quot;0x0101&quot;                 Location=&quot;EditControlBlock&quot;                 Sequence=&quot;10001&quot;                 Title=&quot;$Resources:ContextMenu_AttachToNewDocument&quot;&gt;      &lt;UrlAction Url=&quot;~remoteAppUrl\/Navigator\/SharepointAction\/?SPHostUrl={HostUrl}&amp;SPListId={ListId}&amp;SPListItemsId={ItemId}&quot; \/&gt;   &lt;\/CustomAction&gt; &lt;\/Elements&gt; <\/code><\/pre>\n<p>  \u0420\u0430\u0437\u0431\u0435\u0440\u0435\u043c \u043f\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0443 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b:<br \/>  <b>RegistrationType &#038; RegistrationId<\/b> \u2014 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u043a\u043e\u043c\u0431\u0438\u043d\u0430\u0446\u0438\u044e, \u043f\u0440\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u0443\u043d\u043a\u0442 \u043c\u0435\u043d\u044e \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c\u0441\u044f (\u0442\u043e, \u0447\u0442\u043e \u0431\u044b\u043b\u043e \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0432 \u0432\u0438\u0437\u0430\u0440\u0434\u0435; \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043d\u0430 \u0431\u043e\u043b\u044c\u0448\u0438\u0439 \u0441\u043f\u0435\u043a\u0442\u0440 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f)<br \/>  <b>Location<\/b> \u2014 \u0433\u0434\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442\u0441\u044f (\u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u043d\u043e\u0435 \u043c\u0435\u043d\u044e)<br \/>  <b>Sequence<\/b> \u2014 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0432 \u043c\u0435\u043d\u044e<br \/>  <b>Title<\/b> \u2014 \u0412\u0438\u0434\u0438\u043c\u043e\u0435 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435. \u0417\u0434\u0435\u0441\u044c \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c, \u0447\u0442\u043e \u0443\u0436\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0430 \u043b\u043e\u043a\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f. \u0418\u043c\u0435\u043d\u043d\u043e \u0442\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u043b\u043e\u043a\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u0438\u0437 <b>Resources (Host web)<\/b><br \/>  <b>UrlAction<\/b> \u2014 \u043e\u0441\u043d\u043e\u0432\u0430 CustomActions. \u0417\u0434\u0435\u0441\u044c \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f url, \u043a\u0443\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043f\u043e\u0441\u043b\u0435 \u043a\u043b\u0438\u043a\u0430. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u043e\u0435 \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u043b\u044f provider hosted app ~remoteAppUrl. <br \/>  \u0422\u0430\u043a\u0436\u0435 \u0432\u0430\u0436\u043d\u043e \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b SPListId, SPListItemsId \u2014 \u044d\u0442\u043e \u0438\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440\u044b \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u043b\u0438\u0441\u0442\u0430 \u0438 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0445 \u0432 \u043d\u0435\u043c \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e. \u041a\u0430\u043a \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u044b \u043c\u0430\u0440\u043a\u0435\u0440\u044b. \u041f\u043e\u043b\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043f\u043e \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e \u0442\u0430\u043a\u0438\u0445 \u0441\u0441\u044b\u043b\u043e\u043a \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 <a href=\"https:\/\/msdn.microsoft.com\/ru-ru\/library\/office\/jj163816.aspx\">\u0437\u0434\u0435\u0441\u044c<\/a><\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0435\u0440\u0435\u0439\u0434\u0435\u043c \u043a \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0449\u0435\u043c\u0443 action \u043d\u0430\u0448\u0435\u0433\u043e MVC \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f:  <\/p>\n<pre><code>    public ActionResult SharepointAction(SharepointActionModel actionModel)     {         var spContext = SharePointContextProvider.Current.GetSharePointContext(HttpContext);           GetSharepointListItemsAndPerformAction(spContext, actionModel.SpListId.Value, actionModel.SpListItemsId,             (listItems, ids, context, spList) =&gt;             {                 if (spList.BaseType == BaseType.DocumentLibrary)                 {                     richCardId = AttachSharepointDocumentsToDocumentCard(listItems, ids, context);                 }             });           return Redirect(model.UrlToNavigate);     }      public class SharepointActionModel     {         public Guid? SpListId { get; set; }          public string SpListItemsId { get; set; }          public string SpHostUrl { get; set; }     }      private const string DocumentCamlQuery = @&quot;&lt;QueryOptions&gt;&lt;ViewAttributes Scope='All'\/&gt;&lt;\/QueryOptions&gt;                                                 &lt;Where&gt;                                                     &lt;In&gt;                                                         &lt;FieldRef Name='ID' \/&gt;                                                         &lt;Values&gt;                                                             {0}                                                         &lt;\/Values&gt;                                                     &lt;\/In&gt;                                                 &lt;\/Where&gt;&quot;;      private void GetSharepointListItemsAndPerformAction(SharePointContext spContext, Guid listId, string listItemIds, Action&lt;ListItemCollection, List&lt;int&gt;, ClientContext, List&gt; fileAction)     {         try         {             if (spContext == null)                 throw Error.SharepointIntergration();              using (var clientContext = spContext.CreateUserClientContextForSPHost())             {                 var spList = clientContext.Web.Lists.GetById(listId);                 clientContext.Load(spList);                 clientContext.ExecuteQuery();                                  if (spList != null && spList.ItemCount &gt; 0)                 {                     var camlQuery = new CamlQuery();                     camlQuery.ViewXml = String.Format(DocumentCamlQuery, GetFilterValues(listItemIds));                      var listItems = spList.GetItems(camlQuery);                      clientContext.Load(listItems);                     clientContext.ExecuteQuery();                      var stringIds = listItemIds.Split(new[] { &quot;,&quot; }, StringSplitOptions.RemoveEmptyEntries);                     var ids = ConvertToIntFromStringIds(stringIds);                      fileAction(listItems, ids, clientContext, spList);                 }             }         }         catch (Exception ex)         {             Trace.TraceError(ex);             throw;         }     } <\/code><\/pre>\n<p>  \u0414\u0430\u043b\u0435\u0435, \u0441 \u043a\u043d\u043e\u043f\u043a\u0430\u043c\u0438 \u0432 \u0440\u0438\u0431\u0431\u043e\u043d\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0441\u0435 \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435, \u0434\u043e\u0431\u0430\u0432\u0438\u0432 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 <b>Ribbon Custom Action<\/b>. \u041f\u0440\u0438\u0447\u0435\u043c \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u043f\u0440\u0430\u0432\u0438\u0442\u044c url \u0432 \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435 \u043c\u0435\u0441\u0442\u043e, \u0437\u0430\u0440\u0430\u043d\u0435\u0435 \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0435\u0432, \u0447\u0442\u043e \u0432 <b>SPListItemsId<\/b> \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432, \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u0437\u0430\u043f\u044f\u0442\u043e\u0439. \u0412 \u043a\u043e\u0434\u0435 \u0432\u044b\u0448\u0435 \u044d\u0442\u043e \u0443\u0436\u0435 \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043e.<\/p>\n<p>  <b>SharePoint AppParts<\/b><\/p>\n<p>  AppPart \u2014 \u0435\u0449\u0435 \u043e\u0434\u0438\u043d \u044d\u043b\u0435\u043c\u0435\u043d\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0432 SharePoint \u0447\u0435\u0440\u0435\u0437 App. \u041d\u043e \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c SharePoint \u0441\u0430\u043c \u0440\u0435\u0448\u0430\u0435\u0442, \u0433\u0434\u0435 \u0438 \u043a\u0443\u0434\u0430 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u044d\u0442\u043e\u0442 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0435. \u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0438\u0434\u0435\u044f AppPart \u2014 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0447\u0430\u0441\u0442\u044c \u0432\u0430\u0448\u0435\u0433\u043e high-trusted \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0442\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u044e iframe. \u0412 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 SharePoint \u044d\u0442\u043e \u0436\u0435 \u0431\u044b\u043b\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043e \u0447\u0435\u0440\u0435\u0437 WebParts.<\/p>\n<p>  \u0418\u0442\u0430\u043a, \u043a\u0430\u043a \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c App-part \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043e\u043f\u0438\u0441\u0430\u043d\u043e \u0442\u043e\u0436\u0435 \u043d\u0430 <a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/office\/fp179921.aspx\">MSDN<\/a>.<br \/>  \u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0435\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442 \u043c\u043e\u0436\u043d\u043e \u0441\u043d\u043e\u0432\u0430, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0432\u0438\u0437\u0430\u0440\u0434 Visual Studio \u0438 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u0437 \u0441\u0435\u0431\u044f \u0442\u043e\u0436\u0435 xml \u0444\u0430\u0439\u043b \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u044f:  <\/p>\n<pre><code class=\"xml\">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt; &lt;Elements xmlns=&quot;http:\/\/schemas.microsoft.com\/sharepoint\/&quot;&gt;   &lt;ClientWebPart Name=&quot;Approvals&quot; Title=&quot;$Resources:AppPart_Approvals_Title&quot; Description=&quot;$Resources:AppPart_Approvals_Description&quot; DefaultWidth=&quot;850&quot; DefaultHeight=&quot;150&quot;&gt;     &lt;Content Type=&quot;html&quot; Src=&quot;~remoteAppUrl\/Navigator\/ApprovalAppPart?{StandardTokens}&quot; \/&gt;   &lt;\/ClientWebPart&gt; &lt;\/Elements&gt; <\/code><\/pre>\n<p>  \u041d\u0430\u0432\u0435\u0440\u043d\u044f\u043a\u0430 \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043c\u0435\u043d\u044f\u0442\u044c \u0440\u0430\u0437\u043c\u0435\u0440\u044b app part \u043f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u0430. \u042f \u043e\u0441\u0442\u0430\u0432\u043b\u044e \u043d\u0438\u0436\u0435 javascript \u043a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u043f\u0440\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u0430 \u043d\u0430 \u0441\u0442\u043e\u0440\u043e\u043d\u0435 ASP.NET MVC \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f:  <\/p>\n<pre><code class=\"javascript\">    function ResizeIFrame() {         if (!IsSharepointAppPart())             return;          var oBody = document.body;         var innerHeight = $(&quot;.app-part-content&quot;, oBody).height();          var dheight = innerHeight + (oBody.offsetHeight - oBody.clientHeight);         var dwidth = oBody.scrollWidth + (oBody.offsetWidth - oBody.clientWidth);          var message = &quot;&lt;Message senderId=&quot; + senderId + &quot; &gt;&quot;             + &quot;resize(&quot; + dwidth + &quot;,&quot; + dheight + &quot;)&lt;\/Message&gt;&quot;;         window.parent.postMessage(message, document.referrer);     }      function IsSharepointAppPart() {         return IsInsideIframe();     }      function IsInsideIframe() {         return window.self !== window.top;     } <\/code><\/pre>\n<p>  \u041f\u043e\u0436\u0430\u043b\u0443\u0439, \u043d\u0430 \u044d\u0442\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u0442\u044c. \u0412 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0440\u0430\u0437 \u044f \u043d\u0430\u043f\u0438\u0448\u0443, \u043a\u0430\u043a \u043c\u044b \u0441\u043e\u0437\u0434\u0430\u043b\u0438 \u0441\u0432\u043e\u0439 Ribbon Tab, SharePoint Solution \u0438 \u0441\u0432\u044f\u0437\u0430\u043b\u0438 \u0435\u0433\u043e c SharePoint App.               <\/p>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/269499\/\"> http:\/\/habrahabr.ru\/post\/269499\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>       \u0412 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 <a href=\"http:\/\/habrahabr.ru\/company\/docsvision\/blog\/242325\/\/\">\u0418\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f ASP.NET MVC c Sharepoint 2013. Part 1: High-Trusted provider-hosted APP<\/a> \u0431\u044b\u043b\u043e \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u043d\u043e, \u043a\u0430\u043a \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c SharePoint 2013 \u0434\u043b\u044f SharePoint Apps (\u0442\u0435\u043f\u0435\u0440\u044c Microsoft \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u044d\u0442\u043e <a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/office\/fp161507.aspx#bk_newname\">SharePoint Add-in<\/a>) \u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0431\u0430\u0437\u043e\u0432\u0443\u044e \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f ASP.NET MVC \u0441 provider-hosted APP. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043f\u043e\u043a\u0430\u0436\u0443, \u043a\u0430\u043a \u043c\u044b \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b\u0438: \u043f\u043e\u0438\u0441\u043a \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 SharePoint Site \u0432 MVC \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438, \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0443 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u0438\u0437 SharePoint Site, App-parts \u0438 \u043b\u043e\u043a\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 SharePoint.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-266851","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/266851","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=266851"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/266851\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=266851"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=266851"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=266851"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}