I am using the Microsoft Graph SDK to update range format of the worksheet as code snippets shown below:
GraphServiceClient graphClient = new GraphServiceClient(authProvider);
var workbookRangeFormat = new WorkbookRangeFormat
{
HorizontalAlignment = "Center",
VerticalAlignment = "Top",
RowHeight = 49
};
await graphClient.Me.Drive.Items[fileId].Workbook
.Worksheets[sheetName].Range(range).Format
.Request()
.UpdateAsync(workbookRangeFormat);
But there is compiling error:
error CS1061: 'IWorkbookWorksheetRangeRequestBuilder' does not contain
a definition for 'Format' and no accessible extension method 'Format'
accepting a first argument of type
'IWorkbookWorksheetRangeRequestBuilder' could be found (are you
missing a using directive or an assembly reference?)
Reference: Update range format
The Assembly Microsoft.Graph Version: 1.16.0.0.
There is an issue with the API, basically not yet complete even though the documentation says otherwise. See here,#233
Related
I am upgrading a .net45 app to .net core 3.1 and I have a piece of code there like below.
private void GetContainerDirectories(IEnumerable<IListBlobItem> blobList)
{
// First list all the actual FILES within
// the current blob list. No recursion needed:
foreach (var item in blobList.Where
((blobItem, type) => blobItem is CloudBlockBlob))
{
var blobFile = item as CloudBlockBlob;
sb.Add(new Tree { Name = blobFile.Name, Id = blobFile.Name, ParentId = blobFile.Parent.Prefix, Title = Path.GetFileName(blobFile.Name), IsDirectory = false });
}
// List all additional subdirectories
// in the current directory, and call recursively:
foreach (var item in blobList.Where
((blobItem, type) => blobItem is CloudBlobDirectory))
{
var directory = item as CloudBlobDirectory;
sb.Add(new Tree { Name = directory.Prefix, Id = directory.Prefix, ParentId = directory.Parent.Prefix, Title = new DirectoryInfo(directory.Prefix).Name, IsDirectory = true });
// Call this method recursively to retrieve subdirectories within the current:
GetContainerDirectories(directory.ListBlobs()); ***////////Here i am getting error***
}
}
In the last line [ GetContainerDirectories(directory.ListBlobs()) ], I am getting error for ListBlobs and I am not able to find any useful solution for this. The error like this -
'CloudBlobDirectory' does not contain a definition for 'ListBlobs' and no accessible extension method 'ListBlobs' accepting a first argument of type 'CloudBlobDirectory' could be found (are you missing a using directive or an assembly reference?)
Has anyone any idea how to fix this ? Many thanks in advance :)
The WindowsAzure.Storage SDK you are using is too old, .net core does not support the synchronous methods under this SDK, and the ListBlobs method is a synchronous method.
I suggest you use the latest SDK instead:
https://www.nuget.org/packages/Azure.Storage.Blobs/12.8.0
If you don't want to use Azure.Storage.Blobs SDK, you can use ListBlobsSegmentedAsync method under WindowsAzure.Storage SDK
Update:
You can use the code below to instead of your original code:
var blobs = directory.ListBlobsSegmentedAsync(false, BlobListingDetails.Metadata, 100, null, null, null).Result.Results;
GetContainerDirectories(blobs);
I'm creating a Xamarin forms app which enables user uploads. I have installed the latest version of the Xamarin.Essentials package but the classes and methods which I would expect to be available cannot be found. I can move ahead with the xamarin.plugins.filepicker package but this is not well documented and I would prefer to use the standard library. Any assistance with this would be greatly appreciated! The default is below.
'''
async Task<FileResult> PickAndShow(PickOptions options)
{
try
{
var result = await FilePicker.PickAsync();
if (result != null)
{
Text = $"File Name: {result.FileName}";
if (result.FileName.EndsWith("jpg", StringComparison.OrdinalIgnoreCase) ||
result.FileName.EndsWith("png", StringComparison.OrdinalIgnoreCase))
{
var stream = await result.OpenReadAsync();
Image = ImageSource.FromStream(() => stream);
}
}
}
catch (Exception ex)
{
// The user canceled or something went wrong
}
}
'''
For the Xamarin.Essentials package, update to the latest version on both Xamarin.Form NuGet Package and Android NuGet Package. After that you could fix the errors like below.
Error CS0246 The type or namespace name 'PickOptions' could not be found (are you
missing a using directive or an assembly reference?)
For the usage of Xamarin.Essentials: File Picker, you could check the MS document.
https://learn.microsoft.com/en-us/xamarin/essentials/file-picker?tabs=android
If you wanna the source file, you could download from the link below. https://github.com/xamarin/Essentials/tree/main/Xamarin.Essentials/FilePicker
I'm currently trying to get a CCD from Cerner's CODE using the FHIR DocumentReference resource. In order to get a CCD the $docref operation has to be passed in the URL (example below) but the FHIR library we are using doesn't allow to use this operation.
http://fhir.cerner.com/millennium/dstu2/infrastructure/document-reference/#operation-docref
Any ideas? Anyone has been able to do this in C#?
You can use the official FHIR library for .Net, see https://github.com/FirelyTeam/fhir-net-api for the source, or add the Hl7.Fhir.Dstu2 library it to your project through NuGet.
This library has a FhirClient, that you can point to your endpoint and use to call the operation.
Here's how that could be achieved - values taken from the documentation you linked to:
var c = new FhirClient("https://fhir-open.cerner.com/dstu2/ec2458f2-1e24-41c8-b71b-0e701af7583d/");
var p = new Parameters();
p.Parameter.Add(new Parameters.ParameterComponent() { Name = "patient", Value = new FhirString("12724066") });
p.Parameter.Add(new Parameters.ParameterComponent() { Name = "type", Value = new CodeableConcept("http://loinc.org", "34133-9") });
var result = c.TypeOperation<DocumentReference>("docref", p, useGet: true);
I'm trying to write a UnmatchedClassAndFilename diagnostic and code fix using the new Roslyn and Visual Studio API's. The idea is to rename a class or filename in case they aren't equal.
How can I use the Roslyn API to rename a file in Visual Studio? The Workspace class doesn't seem to support this.
Update: Created an issue at CodePlex (https://roslyn.codeplex.com/workitem/258)
No, there is no current support for this in the Workspaces API. It's a common request but I'm not sure we have something explicitly tracking that work, so feel free to file the bug on CodePlex.
I am using Visual Studio 2017 and the Code Refactoring VSIX project template to accomplish this.
Here is my code:
private async Task<Solution> ConvertTypeNameToPascalCaseAsync(Document document, TypeDeclarationSyntax typeDecl, CancellationToken cancellationToken)
{
// Produce a PascalCased version of the type declaration's identifier token.
var identifierToken = typeDecl.Identifier;
var newName = identifierToken.Text.ToPascalCase();
// Get the symbol representing the type to be renamed.
var semanticModel = await document.GetSemanticModelAsync(cancellationToken);
var typeSymbol = semanticModel.GetDeclaredSymbol(typeDecl, cancellationToken);
// Produce a new solution that has all references to that type renamed, including the declaration.
var originalSolution = document.Project.Solution;
var optionSet = originalSolution.Workspace.Options;
var newSolution = await Renamer.RenameSymbolAsync(document.Project.Solution, typeSymbol, newName, optionSet, cancellationToken).ConfigureAwait(false);
var newDocId = DocumentId.CreateNewId(document.Project.Id);
var newText = await newSolution.GetDocument(document.Id).GetTextAsync(cancellationToken).ConfigureAwait(false);
// rename document by adding a new document with the new name and removing the old document
newSolution = newSolution.AddAdditionalDocument(newDocId, newName + ".cs", newText);
newSolution = newSolution.RemoveDocument(document.Id);
// Return the new solution with the now PascalCased type name.
return newSolution;
}
Note: ToPascalCase() is an extension method that I added to the string class.
The major point to notice is that I used AddAdditionalDocument() and RemoveDocument() to effectively rename the existing document to match my new name.
Here is the code that sets up the Code Refactoring engine:
public sealed override async Task ComputeRefactoringsAsync(CodeRefactoringContext context)
{
var root = await context.Document.GetSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false);
// Find the node at the selection.
var node = root.FindNode(context.Span);
// Only offer a refactoring if the selected node is a type declaration node.
var typeDecl = node as TypeDeclarationSyntax;
if (typeDecl == null)
{
return;
}
if (typeDecl.Identifier.Text.IsUpper())
{
// For any type declaration node, create a code action to reverse the identifier text.
var action = CodeAction.Create("Convert type name to PascalCase", c => ConvertTypeNameToPascalCaseAsync(context.Document, typeDecl, c));
// Register this code action.
context.RegisterRefactoring(action);
}
}
Note: IsUpper() is also an extension method that I added to the string class.
Incidentally, my specific use case is to convert all caps class names with underscores in them to PascalCased class names. Examples:
TEST = Test
TEST_CLASS = TestClass
TEST_A_CLASS = TestAClass
I am using breeze and the filter does not work.
var EntityQuery = breeze.EntityQuery;
var manager = configureBreezeManager("xxx");
function configureBreezeManager(param) {
breeze.NamingConvention.camelCase.setAsDefault();
var mgr = new breeze.EntityManager(param);
model.configureMetadataStore(mgr.metadataStore);
return mgr;
}
And my query query
var query = EntityQuery.from('GetStudents').where("Id", "==", "xxx");
return manager.executeQuery(query)
The filter is ignore and all results are returned. my get student returns an IQueryable of all students.
public IQueryable<Students> GetStudents(){
return context.Students;
}
Is there something up there I am doing wrong or should I look elsewhere?
EDIT
I realize that my controller is missing the property [BreezeController]. But when I include that, me metadata path is not found giving me an error (error 500 below) when trying to load it. The matadata loads fine without this property on the controller, but filtering does not work. Is this related?
"Could not load file or assembly 'System.Web.Http.OData, ... or one of its dependencies. The system cannot find the file specified."
Your issue might be that you have specified a 'camelCase' namingConvention, but your query is for 'Id' instead of 'id'. i.e. try:
var query = EntityQuery.from('GetStudents').where("id", "==", "xxx");
return manager.executeQuery(query)
I was missing the [BreezeController] and after adding it, I received the error Could not load file or assembly System.Web.Http.OData, Version=4.0.0.0 and was able to solve it by runing Install-Package Microsoft.AspNet.WebApi.OData in the package manager