当前位置: 首页>>代码示例>>C#>>正文


C# ListItemCollection.Cast方法代码示例

本文整理汇总了C#中ListItemCollection.Cast方法的典型用法代码示例。如果您正苦于以下问题:C# ListItemCollection.Cast方法的具体用法?C# ListItemCollection.Cast怎么用?C# ListItemCollection.Cast使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ListItemCollection的用法示例。


在下文中一共展示了ListItemCollection.Cast方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SendIndividualDocument

 /// <summary>
 /// Sends individual document to OneDrive
 /// </summary>
 /// <param name="clientContext">SP client context</param>
 /// <param name="collectionOfAttachments">Dictionary object containing attachment URLs and their stream data</param>
 /// <param name="listItemsColl">List item collection of Legal Briefcase folder</param>
 /// <param name="allAttachmentUrl">A string array containing all the attachment URLs</param>
 /// <param name="web">Object of site</param>
 /// <param name="usersMySite">My Site URL of the user</param>
 /// <param name="collectionOfOriginalAttachments">Dictionary object containing attachment URLs</param>
 /// <param name="defaultContentTypeId">Default content type Id</param>
 /// <param name="status">Status of documents sent to OneDrive</param>
 /// <returns>Status of documents sent to OneDrive</returns>
 internal static string SendIndividualDocument(ClientContext clientContext, Dictionary<string, Stream> collectionOfAttachments, ListItemCollection listItemsColl, string[] allAttachmentUrl, Microsoft.SharePoint.Client.Web web, string usersMySite, Dictionary<string, string> collectionOfOriginalAttachments, string defaultContentTypeId, string status)
 {
     int documentCount = 0, count = 0;
     string fileNameKey = string.Empty;
     string overwriteDocumentURLs = string.Empty;
     foreach (string key in collectionOfAttachments.Keys)
     {
         fileNameKey = key.Split(new string[] { ConstantStrings.DOLLAR }, StringSplitOptions.RemoveEmptyEntries)[0];
         var selectedItems = from li in listItemsColl.Cast<ListItem>()
                             from files in li.Folder.Files
                             where files.Name.ToUpperInvariant() == fileNameKey.ToUpperInvariant()
                             select files;
         if (selectedItems.FirstOrDefault() != null)
         {
             overwriteDocumentURLs += allAttachmentUrl[count] + ConstantStrings.Semicolon;
         }
         else
         {
             SendDocumentToOneDrive(web, usersMySite, fileNameKey, collectionOfAttachments[key], collectionOfOriginalAttachments[key], defaultContentTypeId);
             documentCount++;
         }
         count++;
         web.Update();
         clientContext.ExecuteQuery();
         MailAttachmentDetails.CheckoutFailedPosition++;
         status = string.Concat(usersMySite, ServiceConstantStrings.OneDriveDocumentLibraryTitle, ConstantStrings.Semicolon, documentCount, ConstantStrings.Semicolon, collectionOfAttachments.Count, ConstantStrings.Semicolon, overwriteDocumentURLs);
     }
     return status;
 }
开发者ID:MatthewSammut,项目名称:mattercenter,代码行数:42,代码来源:BriefcaseUtilityHelperFunctions.cs


注:本文中的ListItemCollection.Cast方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。