我有以下问题:
我需要从属于"设备"的特定日历的日历规则中删除或删除"超时规则".需要这样做,以便设备可用于在服务日历上进行安排.
不知何故,我无法理解如何做到这一点.
我能够检索需要删除的日历规则对象,但下一步就是我.
请小心告诉我:
可以通过C#(SDK)完成
任何类似的Web资源或代码部分.
以下代码给出了错误
您尝试删除的对象与另一个对象关联,无法删除.
//equip is of Equipment type and is already initialized
CrmEarlyBound.Calendar cal = (CrmEarlyBound.Calendar)svc.Retrieve("calendar", equip.CalendarId.Id, new ColumnSet(true));
Console.WriteLine("Got the user calendar");
List<CalendarRule> calendarRules = cal.CalendarRules.ToList();
Console.WriteLine("Got the calendar rules " + cal.CalendarRules.ToList().Count);
foreach (CalendarRule cr in cal.CalendarRules)
{
if (cr.Description == "Time Off Rule" && cr.StartTime.Value>=DateTime.Now)
{
Console.WriteLine(cr.StartTime);
Calendar calI = (Calendar)svc.Retrieve(cr.InnerCalendarId.LogicalName, cr.InnerCalendarId.Id, new ColumnSet(true));
//svc.Delete(cr.InnerCalendarId.LogicalName, cr.InnerCalendarId.Id);
}
}
Run Code Online (Sandbox Code Playgroud) 我很惭愧地问这个问题,但不知怎的,我错过了一些东西.
脚本
有一个sharepoint实例sharepoint中有一个文档列表,有三个文件,我有一个asp.net MVC Portal,它与Sharepoint实例连接在一个视图中,它显示了文件列表(在我的例子中为3)当用户点击该项目时,该文件将被下载.
该文件已下载,但当您尝试打开它时,word表示下载的文件已损坏.
我用Google搜索并尝试了各种代码变体.只有有效的变体是将文件保存在服务器上,然后将其下载到客户端,如您所知,这是不可行的
这是我的代码
如上所述,Sharepoint登录,身份验证等都能正常工作fileref是从Sharepoint检索文件len的共享点路径// int len = int.Parse(oListItemDoc.FieldValues ["File_x0020_Size"].ToString());
string filePath = fileRef;
ClientContext clientContext = new ClientContext(GetSharePointUrl());
clientContext = SharepointAuthorisation(clientContext);
if (!string.IsNullOrEmpty(filePath))
{
var cd = new System.Net.Mime.ContentDisposition
{
FileName = Path.GetFileName(fileRef),
// always prompt the user for downloading, set to true if you want
// the browser to try to show the file inline
Inline = true,
};
Response.AppendHeader("Content-Disposition", cd.ToString());
byte[] fileArr=DownloadFile(title, clientContext, filePath,len,extension, "");
//FileInformation fileInfo = Microsoft.SharePoint.Client.File.OpenBinaryDirect(clientContext, fileRef.ToString());
//byte[] arr …Run Code Online (Sandbox Code Playgroud) 我正在尝试通过控制台应用程序与Azure Blob存储上的容器通信。我无法使用SDK,因此REST是我唯一的选择。使用.NET 4.5.2的语言是C#。
我试过这两个代码,都返回相同的错误
Azure Rest API将Blob放在StackOverflow上
还有其他人遇到过同样的问题并成功解决了吗?
我为几乎所有内容都添加了带有(*)的CORS规则
该代码是两个链接的完全重复,因此我不在这里添加它。
class Program
{
static void Main(string[] args)
{
UploadBlobWithRestAPI();
}
public static void UploadBlobWithRestAPI()
{
string storageKey = "ffFJwPXTqyYvRoubNQEti/aQUUMwn41BG3KDtl/yGpG4DR1eKaHRq6Bhbw==";
string storageAccount = "xyz";
string containerName = "notes";
string blobName = "test567";
string method = "PUT";
string sampleContent = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla id euismod urna. Maecenas scelerisque dolor purus, sed ullamcorper ipsum lobortis non. Nulla est justo, sodales at venenatis …Run Code Online (Sandbox Code Playgroud)