我正在尝试从CRM安装中提取信息,到目前为止,这对于使用默认字段很好.但是我在检索自定义字段时遇到了困难,例如,Contacts有一个名为web_username的自定义字段.
我目前的代码是
QueryExpression query = new QueryExpression();
query.EntityName = "contact";
ColumnSet cols = new ColumnSet();
cols.Attributes = new string[] { "firstname", "lastname" };
query.ColumnSet = cols;
BusinessEntityCollection beReturned = tomService.RetrieveMultiple(query);
foreach (contact _contact in beReturned.BusinessEntities)
{
DataRow dr = dt.NewRow();
dr["firstname"] = _contact.firstname;
dr["lastname"] = _contact.lastname;
dt.Rows.Add(dr);
}
Run Code Online (Sandbox Code Playgroud)
如何在查询中包含自定义字段?我已经尝试过搜索但没有运气但我可能会错误地搜索,因为我不熟悉CRM术语.
提前干杯!
我写了一个小应用程序来获取.cab文件中包含的文件版本号.
我将所有文件从cab提取到临时目录并循环遍历所有文件并检索版本号,如下所示:
//Attempt to load .net assembly to retrieve information
Assembly assembly = Assembly.LoadFile(tempDir + @"\" + renameTo);
Version version = assembly.GetName().Version;
DataRow dr = dt.NewRow();
dr["Product"] = renameTo;
dr["Version"] = version.ToString();
dt.Rows.Add(dr);
Run Code Online (Sandbox Code Playgroud)
然后,当我完成后,我想删除已提取的所有文件,如下所示:
foreach (string filePath in filePaths)
{
//Remove read-only attribute if set
FileAttributes attributes = File.GetAttributes(filePath);
if ((attributes & FileAttributes.ReadOnly) == FileAttributes.ReadOnly)
{
File.SetAttributes(filePath, attributes ^ FileAttributes.ReadOnly);
}
File.Delete(filePath);
}
Run Code Online (Sandbox Code Playgroud)
这适用于所有文件,除了有时在.net .exe上失败.我可以手动删除该文件,使其看起来不会被锁定.
我应该寻找什么来使这项工作?Assembly.LoadFile可能是锁定文件吗?
我正在Windows 7上使用Xamarin Studio 4.0.3(以前的 MonoDevelop)学习C#。尝试使用类(只有一段代码)Stopwatch
using System.Diagnostics;
class MainClass {
public static void Main (string[] args) {
Stopwatch stopWatch = new Stopwatch();
}
}
Run Code Online (Sandbox Code Playgroud)
我得到:
错误 CS0246:找不到类型或命名空间名称“秒表”。您是否缺少 using 指令或程序集引用?
我的目标框架是:Mono .NET 4.0。根据MSDN秒表类应该实现。
顺便说一句,DateTime类工作正常。
问题是:我是否遗漏了什么(正确的命名空间、库链接)或秒表根本没有实现?
我的windows phone 7 silverlight app在将图钉放在地图图层上之前删除了之前存在的任何内容.
我在foreach循环中这样做如下:
//Clear previous pins
try
{
foreach (UIElement p in PushPinLayer.Children)
{
if(p.GetType() == typeof(Pushpin))
{
PushPinLayer.Children.Remove(p);
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
//TODO: For some reason the foreach loop above causes an invalid Operation exception.
//Cathing the error here until I can work out why it is happening.
}
Run Code Online (Sandbox Code Playgroud)
此代码根据需要删除任何图钉但在最后一个循环之后会抛出异常"无效操作"我将其重新编写为for循环:
for (int i = 0; i < PushPinLayer.Children.Count; i++)
{
if (PushPinLayer.Children[i].GetType() == typeof(Pushpin))
{
PushPinLayer.Children.RemoveAt(i);
}
}
Run Code Online (Sandbox Code Playgroud)
哪个工作正常,但我不明白为什么foreach抛出错误.
在测试我们在Windows 10上为Windows 8/8.1开发的Windows应用商店应用时,我们发现点击文本框不会显示触摸键盘.
我已经创建了一个新项目来测试使用以下XAML定义的文本框
<TextBox x:Name="testTextBox" HorizontalAlignment="Left" Margin="469.901,314.495,0,0" InputScope="Number"
TextWrapping="Wrap" Text="" VerticalAlignment="Top" Height="37" Width="383" RenderTransformOrigin="0.5,0.5"
UseLayoutRounding="False" d:LayoutRounding="Auto">
</TextBox>
Run Code Online (Sandbox Code Playgroud)
它似乎InputScope="Number"有效果,因为如果我手动打开触摸键盘,它显示数字键盘,但是当文本框获得焦点时(即,它被点击),我无法打开触摸键盘.
我也尝试通过代码设置此值,如下所示:
InputScope scope = new InputScope();
InputScopeName scopeName = new InputScopeName();
scopeName.NameValue = InputScopeNameValue.Number;
scope.Names.Add(scopeName);
testTextBox.InputScope = scope;
Run Code Online (Sandbox Code Playgroud)
更新 我发现有一个设置平板电脑模式,当打开触摸键盘确实按我的预期启动.
我正在尝试创建一个包含创建存储帐户的 ARM 模板。
我想创建一个StorageV2 (general purpose v2)帐户,但这似乎失败了,因为架构StorageV2中不存在。
{
"name": "[variables('xblobstorageName')]",
"type": "Microsoft.Storage/storageAccounts",
"location": "[resourceGroup().location]",
"apiVersion": "2016-01-01",
"sku": {
"name": "[parameters('xblobstorageType')]"
},
"dependsOn": [],
"tags": {
"displayName": "xblobstorage"
},
"kind": "StorageV2"
}
Run Code Online (Sandbox Code Playgroud)
唯一允许的值kind是Storage等BlobStorage,当尝试部署上述模板时,收到以下错误:
"error": {
"code": "AccountPropertyIsInvalid",
"message": "Account property kind is invalid for the request."
}
Run Code Online (Sandbox Code Playgroud)
是否可以使用 ARM 模板创建 V2 存储帐户?
我正在努力完成一项非常简单的任务,即StorageFile从StorageFolder修改日期的降序中获取列表.
检索列表但未排序的当前代码
Task<IReadOnlyList<StorageFile>> task = folder.Result.GetFilesAsync().AsTask();
task.Wait();
return task.Result.Select(z => z.Name).ToArray();
Run Code Online (Sandbox Code Playgroud)
StorageFile有一个属性,DateCreated但与DateModified没有任何相似之处.
我查看了使用,GetFilesAsync(Windows.Storage.Search.CommonFileQuery.OrderByDate)但这仅适用于Windows库中的文件.
我正在使用DirectX在visual studio中工作,今天我遇到了一些奇怪的编译器错误(对我来说没有任何意义)......
这些是我得到的错误:
错误C2143:语法错误:缺少';' 在'.'之前 错误C2059:语法错误:')'
我已经仔细检查了我的代码并且没有发现任何错别字/错误(我可能错了......)
我希望有人可以告诉我错误通常意味着什么以及在哪里看...
我会在下面放一些代码,指出发生错误的行(如果你想检查的话)
额外信息:m_ImTexture2D是一个成员结构.Vertex.PosTex是结构中的结构
GameManager.cpp:
(231): error C2143: syntax error : missing ';' before '.'
(231): error C2143: syntax error : missing ';' before '.'
(232): error C2143: syntax error : missing ';' before '{'
(233): error C2143: syntax error : missing ';' before '}'
(233): error C2143: syntax error : missing ';' before ','
(234): error C2143: syntax error : missing ';' before '{'
(234): error C2143: syntax error : missing ';' before …Run Code Online (Sandbox Code Playgroud) c++ compiler-construction directx compiler-errors visual-studio-2010
c# ×6
asp.net ×1
assemblies ×1
azure ×1
c++ ×1
directx ×1
dynamics-crm ×1
keyboard ×1
windows-10 ×1
windows-8.1 ×1