コード例 #1
0
ファイル: ContentUploadManager.cs プロジェクト: olemp/sherpa
        private void ApplyFileProperties(ClientContext context, IEnumerable<ShFileProperties> filePropertiesCollection, File uploadFile)
        {
            if (filePropertiesCollection != null)
            {
                var fileProperties = filePropertiesCollection.SingleOrDefault(f => f.Url == uploadFile.Name);
                if (fileProperties != null)
                {
                    var filePropertiesWithTokensReplaced = new Dictionary<string, string>();
                    foreach (KeyValuePair<string, string> keyValuePair in fileProperties.Properties)
                    {
                        filePropertiesWithTokensReplaced.Add(keyValuePair.Key, GetPropertyValueWithTokensReplaced(keyValuePair.Value, context));
                    }
                    uploadFile.SetFileProperties(filePropertiesWithTokensReplaced);

                    if (uploadFile.Name.ToLower().EndsWith(".aspx")) 
                        AddWebParts(context, uploadFile, fileProperties.WebParts, fileProperties.ReplaceWebParts);
                    context.ExecuteQuery();
                }
            }
        }