本文整理汇总了C#中Microsoft.GetItems方法的典型用法代码示例。如果您正苦于以下问题:C# Microsoft.GetItems方法的具体用法?C# Microsoft.GetItems怎么用?C# Microsoft.GetItems使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft
的用法示例。
在下文中一共展示了Microsoft.GetItems方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetListItems
protected static Microsoft.SharePoint.Client.ListItemCollection GetListItems(ClientContext context, Microsoft.SharePoint.Client.List list, CamlQuery query)
{
Microsoft.SharePoint.Client.ListItemCollection coll = null;
coll = list.GetItems(query);
context.Load(coll);
context.ExecuteQuery();
return coll;
}
示例2: UpgradeCSharpConfiguration
private static bool UpgradeCSharpConfiguration(EnvDTE.Project dteProject,
Microsoft.Build.Evaluation.Project project, OldConfiguration cfg)
{
ProjectPropertyGroupElement propertyGroup = project.Xml.PropertyGroups.FirstOrDefault(g => g.Label.Equals("IceBuilder"));
if (propertyGroup == null)
{
propertyGroup = project.Xml.AddPropertyGroup();
propertyGroup.Label = "IceBuilder";
}
if (!String.IsNullOrEmpty(cfg.OutputDir))
{
propertyGroup.AddProperty(PropertyNames.OutputDir, cfg.OutputDir);
}
if (!String.IsNullOrEmpty(cfg.AdditionalOptions))
{
propertyGroup.AddProperty(PropertyNames.AdditionalOptions, cfg.AdditionalOptions);
}
if (!String.IsNullOrEmpty(cfg.IncludeDirectories))
{
propertyGroup.AddProperty(PropertyNames.IncludeDirectories,
String.Format(@"{0};$(IceHome)\slice", cfg.IncludeDirectories));
}
else
{
propertyGroup.AddProperty(PropertyNames.IncludeDirectories, @"$(IceHome)\slice");
}
if (cfg.Stream)
{
propertyGroup.AddProperty(PropertyNames.Stream, "True");
}
if (cfg.Checksum)
{
propertyGroup.AddProperty(PropertyNames.Checksum, "True");
}
if (cfg.Ice)
{
propertyGroup.AddProperty(PropertyNames.AllowIcePrefix, "True");
}
if (cfg.Tie)
{
propertyGroup.AddProperty(PropertyNames.Tie, "True");
}
foreach (String assembly in AssemblyNames)
{
VSLangProj80.Reference3 reference = ProjectUtil.FindAssemblyReference(dteProject, assembly) as VSLangProj80.Reference3;
if(reference != null)
{
reference.SpecificVersion = false;
}
}
List<ProjectItem> sliceItems =
project.GetItems("None").Where(item => Path.GetExtension(item.UnevaluatedInclude).Equals(".ice")).ToList();
//
// Default output directory has changed
//
if (String.IsNullOrEmpty(cfg.OutputDir))
{
project.GetItems("Compile").Where(
item =>
{
return sliceItems.FirstOrDefault(
slice =>
{
return slice.UnevaluatedInclude.Equals(Path.ChangeExtension(item.UnevaluatedInclude, ".ice"));
}) != null;
})
.ToList()
.ForEach(item => project.RemoveItem(item));
}
return true;
}
示例3: UpgadeCppConfiguration
//.........这里部分代码省略.........
}
foreach (ProjectItemDefinitionElement i in group.ItemDefinitions)
{
if (i.ItemType.Equals("ClCompile"))
{
if (!String.IsNullOrEmpty(cfg.OutputDir))
{
ProjectMetadataElement metaData = i.Metadata.FirstOrDefault(
e => e.Name.Equals("AdditionalIncludeDirectories"));
if (metaData != null)
{
List<String> values = new List<String>(metaData.Value.Split(new char[] { ';' }));
values.Remove(cfg.OutputDir);
metaData.Value = String.Join(";", values);
if (values.Count == 0 ||
(values.Count == 1 && values[0].Equals("%(AdditionalIncludeDirectories)")))
{
i.RemoveChild(metaData);
}
else
{
if (!values.Contains("%(AdditionalIncludeDirectories)"))
{
values.Add("%(AdditionalIncludeDirectories)");
}
metaData.Value = String.Join(";", values);
}
}
}
}
else if (i.ItemType.Equals("Link"))
{
ProjectMetadataElement metaData = i.Metadata.FirstOrDefault(
e => e.Name.Equals("AdditionalDependencies"));
if (metaData != null)
{
List<String> values = new List<String>(metaData.Value.Split(new char[] { ';' }));
foreach (String name in CppLibNames)
{
values.Remove(String.Format("{0}.lib", name));
values.Remove(String.Format("{0}d.lib", name));
}
if (values.Count == 0 || (values.Count == 1 && values[0].Equals("%(AdditionalDependencies)")))
{
i.RemoveChild(metaData);
}
else
{
metaData.Value = String.Join(";", values);
}
}
metaData = i.Metadata.FirstOrDefault(e => e.Name.Equals("AdditionalLibraryDirectories"));
if (metaData != null)
{
if (metaData.Value.Equals("%(AdditionalLibraryDirectories)"))
{
i.RemoveChild(metaData);
}
}
}
}
}
List<ProjectItem> sliceItems =
project.GetItems("None").Where(item => Path.GetExtension(item.UnevaluatedInclude).Equals(".ice")).ToList();
//
// Default output directory has changed
//
if(String.IsNullOrEmpty(cfg.OutputDir))
{
foreach (String itemType in new String[] { "ClInclude", "ClCompile" })
{
project.GetItems(itemType).Where(
item =>
{
return sliceItems.FirstOrDefault(
slice =>
{
return slice.UnevaluatedInclude.Equals(Path.ChangeExtension(item.UnevaluatedInclude, ".ice"));
}) != null;
})
.ToList()
.ForEach(item => project.RemoveItem(item));
}
}
sliceItems.ForEach(item =>
{
project.RemoveItem(item);
project.AddItem("IceBuilder", item.UnevaluatedInclude);
});
return true;
}
示例4: AddProjectReferences
void AddProjectReferences(Microsoft.Build.Evaluation.Project p)
{
foreach (Microsoft.Build.Evaluation.ProjectItem item in p.GetItems("ProjectReference"))
{
var projectName = item.GetMetadataValue("Name");
var referenceGuid = Guid.Parse(item.GetMetadataValue("Project"));
_logger.Debug("Adding project reference {0}, {1}", projectName, referenceGuid);
AddReference(new ProjectReference(_solution, projectName, referenceGuid));
}
}
示例5: AddCSharpFiles
void AddCSharpFiles(Microsoft.Build.Evaluation.Project p)
{
foreach (var item in p.GetItems("Compile"))
{
try
{
string path = _fileSystem.Path.Combine(p.DirectoryPath, item.EvaluatedInclude).ForceNativePathSeparator();
if (_fileSystem.File.Exists(path))
{
string file = _fileSystem.FileInfo.FromFileName(path).FullName;
_logger.Debug("Loading " + file);
Files.Add(new CSharpFile(this, file));
}
else
{
_logger.Error("File does not exist - " + path);
}
}
catch (NullReferenceException e)
{
_logger.Error(e);
}
}
}
示例6: AddProjectReferences
void AddProjectReferences(Microsoft.Build.Evaluation.Project p)
{
foreach (Microsoft.Build.Evaluation.ProjectItem item in p.GetItems("ProjectReference"))
{
var projectName = item.HasMetadata("Name")
? item.GetMetadataValue("Name")
: Path.GetFileNameWithoutExtension(item.EvaluatedInclude);
var referenceGuid = Guid.Parse(item.GetMetadataValue("Project"));
_logger.Debug("Adding project reference {0}, {1}", projectName, referenceGuid);
AddReference(new ProjectReference(_solution, projectName, referenceGuid));
}
}
示例7: ReadPageContent
private void ReadPageContent(ClientContext context, Microsoft.SharePoint.Client.List targetList)
{
ListItemCollection listItems = targetList.GetItems(CamlQuery.CreateAllItemsQuery());
context.Load<ListItemCollection>(listItems, items => items.Include(itemFile => itemFile.File).Where(itemFile => itemFile.File != null)); //
context.ExecuteQuery();
context.Load(context.Site);
context.ExecuteQuery();
string siteUrl = context.Site.Url;
foreach (var listItem in listItems)
{
var item = listItem;
context.Load<ListItem>(item);
context.ExecuteQuery();
if (!menuPages.ContainsKey(item.File.Name) && item["WikiField"] != null)
{
menuPages.Add(item.File.Name, new string[] { siteUrl + item["FileRef"], "-1", "0", System.Web.HttpUtility.HtmlDecode(item["WikiField"].ToString()) });
}
}
int position = 1;
int level = 0;
if (menuPages.ContainsKey(Request.QueryString["DefaultPage"]))
menuPages[Request.QueryString["DefaultPage"]][1] = "0";
orderPages(Request.QueryString["DefaultPage"], level, ref position);
foreach (var menuPage in menuPages)
{
if (menuPage.Value[1] == "-1" && Request.QueryString["DefaultPage"] != menuPage.Key && Convert.ToInt32(Request.QueryString["PageLimit"]) > position)
{
menuPage.Value[1] = (position++).ToString();
}
}
}
示例8: GetProjectDependencies
public static void GetProjectDependencies(int iTabLevel, Microsoft.Build.Evaluation.Project prj)
{
string stab = Spaces(iTabLevel);
int iIndex = proj_ref_list.Find(prj);
if (iIndex >= 0)
{
return;
}
else
{
proj_ref_list.Add(prj);
}
var ProjectReference_Items = prj.GetItems("ProjectReference");
foreach (Microsoft.Build.Evaluation.ProjectItem pitm in ProjectReference_Items)
{
Microsoft.Build.Evaluation.Project pr = pitm.Project;
string EvaluatedInclude = pitm.EvaluatedInclude;
string ReferenceProjectCombined = System.IO.Path.Combine(pr.DirectoryPath, EvaluatedInclude);
string refprojfullpath = Path.GetFullPath(ReferenceProjectCombined);
Microsoft.Build.Evaluation.Project ref_pr = Parser.FindProjectInCollection(refprojfullpath);
if (ref_pr != null)
{
GetProjectDependencies( iTabLevel + 1, ref_pr);
}
else
{
MessageBox.Show("Project " + refprojfullpath + " not found in Microsoft.Build.Evaluation.ProjectCollection.GlobalProjectCollection.LoadedProjects!");
}
}
}