Console Apps
25 TopicsConsole App To Write Data To CSV
I am trying to write a pre-defined list of headers to row 1, and List<string> results starting in row 2...my issue is that I get my pre-defined headers written as well as the headers from my List<string> ```cs void WriteResultsToCSV(List<VwExport> records, string fileName) { DateTime currentDate = DateTime.Now; string formattedDate = currentDate.ToString("MM-dd-yyyy"); var filePath = "/Users/owner/Downloads/" + fileName + formattedDate + ".csv"; // Define the headers var headers = new[] { "Job Num", "IM barcode Child", "IM barcode Parent", "ZYL_Presort", "Full Name" }; using (var writer = new StreamWriter(filePath, false, Encoding.UTF8)) using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture)) { foreach (var header in headers) { csv.WriteField(header); } csv.NextRecord(); var trimmedRecords = records.Select(record => new { JobNum = record.JobNum, IMBarcodeDigits = record.ImBarcodeDigits, IMBarcodeCharacters = record.ImBarcodeCharacters, OELPresort = record.OelPresort, FullName = record.FullName }).ToList(); csv.WriteRecords(trimmedRecords); } }```17Views0likes0CommentsCan We add migration file from c#, instead of PackageManagerConsole
Hi, is there any possibilities to add migration file from c# in core project, entity framework code first project. I can able to add the migration file from PackageManagerConsole, but could not able to add from c#109Views0likes1CommentCombine Google Authentication & JWT Tokens using Cookie Authorization
Project is only a web-api, front-end will be developed in react(next.js) Hi guys! I'm a TypeScript Fullstack developer and I'm new to .NET and ASP.NET and basically this is one of my first projects using C# and .NET. My project's architecture requires a kind of different than out-of-the-box way of identifying users. I want Google Authentication which will create a local account (which I can relate other entities to) And JWT Tokens (access, refresh) generated and sent as cookies to the client and each protected endpoint to be using these cookies to authorize the requesting user. I haven't figured out a way of implementing this and still using mostly OOTB tools in order to keep modifications little as possible. Any tips and tricks on how to implement it? Just to be clear, I know how to create endpoints, and protected endpoints using the built in identity framework, using roles, etc... Its this combination of Google Auth, generating tokens, sending them to client as cookies basically is where my difficulty relies. * I have almost a blank new project, already set up with only google credentials167Views0likes0CommentsWhy under arm64, the X64-compiled c# cannot call the x64 dll generated by go?
Under arm64, I am using x64 compiled c# to call go generated x64 dll, the program always abnormal. The same dll, using x64 compiled c++ calls, without any problems Are there any flaws in c# on arm?why c++ code dont have this problem? Thanks536Views0likes1CommentFind email-enabled public folders exclusively using "Microsoft.Office.Interop.Outlook"
Is there a way to exclusively identify email-enabled public folders using Microsoft.Office.Interop.Outlook? EWS or PowerShell should not be used. The program should run on the workstation and utilize the installed Outlook. Once I've found an email-enabled public folder, I should list the emails contained within it. So far, I'm encountering difficulties. For instance, I have the following method: // Recursive method for listing the email addresses of email-enabled public folders static void ListPublicFolders(Outlook.Folder? folder, string indent) { if (folder != null) { foreach (object obj in folder.Folders) { if (obj is Outlook.Folder) { Outlook.Folder? subFolder = obj as Outlook.Folder; if (subFolder != null && subFolder.DefaultItemType == Outlook.OlItemType.olMailItem) { Outlook.MAPIFolder? parentFolder = subFolder.Parent as Outlook.MAPIFolder; string parentName = parentFolder != null ? parentFolder.Name : "Parent folder not found"; Console.WriteLine($"{indent}- {subFolder.Name}: {parentName}"); if (parentFolder != null) { Marshal.ReleaseComObject(parentFolder); } } ListPublicFolders(subFolder, indent + " "); if (subFolder != null) { Marshal.ReleaseComObject(subFolder); } } } } } The query if (subFolder != null && subFolder.DefaultItemType == Outlook.OlItemType.olMailItem) fails becausesubFolder.DefaultItemTypereturns the valueOutlook.OlItemType.olPostItem, even though the public folder was set up as an email-enabled folder in Exchange. Specifically, this is in Microsoft 365. In the Exchange admin center, when creating the folder, I explicitly checked the box for "Email-enabled." This action resulted in two additional options: "Delegation" and "Email properties." In "Email properties," I can specify an alias and a display name. By default, both fields are set to "Orders." Now, I expect the public folder to be email-enabled, with the email addressemail address removed for privacy reasons. I don't understand why Outlook is treating the folder incorrectly (I can only create posts and not send emails). Perhaps someone can help me figure this out. Thank you and best regards, René271Views0likes0CommentsIntegrate the Microsoft.BingAds.UETSdk into our UWP product
Hello, We are currently trying to integrate the UET (Universal Event Tracking) SDK ([Microsoft.BingAds.UETSdk](https://www.nuget.org/packages/Microsoft.BingAds.UETSdk)) into our UWP product. We have been following the documentation closely, but we encounter an issue as soon as we implement the step "Import all of the .NET Native / CoreCLR props" from [this guide](https://learn.microsoft.com/en-us/advertising/guides/windows-app-uet-sdk?view=bingads-13#cpluspluswinrt). After adding this step, when we attempt to submit our UWP package to the Windows Store, we receive the error: "You cannot submit pre-compiled .NET Native packages." For testing purposes, we created an entirely blank project and followed the instructions step by step: 1. Blank project (UetTestBlank.rar and UetTestBlank_1.0.60.0_x86_x64_arm_arm64) - successfully submitted to the Windows Store. 2. Added only the .dll without modifying project settings (UetTestUetPkgOnly_1.0.60.0_x86_x64_arm.appxbundle and UetTestUetPkgOnly.rar) - successfully submitted to the Windows Store. 3. Modified the project by adding "Import all of the .NET Native / CoreCLR props" (UetTestUetPkgWithProjectFileMod.rar and UetTestUetPkgWithProjectFileMod_1_0_60_0_x86_x64_arm_arm64_appxbundle) - submission failed with the error: UetTestUetPkgWithProjectFileMod_1_0_60_0_x86_x64_arm_arm64_appxbundle 3.2 MB, "Package acceptance validation error: You cannot submit pre-compiled .NET Native packages. Please upload the Microsoft Store appxupload file and try again." You can find all the project files here: [Dropbox link](https://www.dropbox.com/scl/fo/d6hr4k24z7sybzg6172r6/AOqBb_2zMBUPCuKgxrmbwhU?rlkey=1pzpak1l1aqcwuejapmmllpid&st=o2wmzce5&dl=0) Could there be any inaccuracies in the documentation, or does anyone have experience working with this library who could provide some guidance or examples? Thank you!234Views0likes0CommentsProgetto avventura testuale
Salve a tutti, ho un sogno nel cassetto scrivere una mia avventura in stile Zork, con piccole aggiunte del mondo di d&d, avevo provato con Python ma è stato un disastro, ho trovato e seguito un tutorial con Godot Engine ma ho riscontrato diversi problemi, ora ci sto provando usando Visual studio code in C#, sto anche seguendo le slide di Microsoft per accrescere anche la mia conoscenza del sistema di programmazione, sto riscontrando diversi problemi ma le cause sono la mia scarsa conoscenza di programmazione e il mio tentato sistema di conversione tra il C usato da Godot e il C usato su VSC, una delle cose che non sto neanche trovando negli help di VSC è: - posso creare un file .cs in cui contengono dei dati (numeri e stringhe) e richiamarli e usare in altri file .cs? per esempio, ho il menù principale, un utente che nn sa cosa fare digita help, si apre lo script (lo chiamo così ma non so se è corretto)dell'help con altri comandi, ci sarà la descrizione dei comandi da usare e come usarli, poi ritorna al menù e inizia con il creare il personaggio partendo dal nome, passando dalla razza e dalla classe (intendo guerriero, mago, ecc..) diciamo che l'utente si trova che non sa cosa scegliere così mentre deve decidere che razza scegliere digita help e si va a leggere i pro ei contro delle varie razze, quando digita per ritornare alla creazione io voglio fare in modo che torni nel punto in cui l'ha lasciato, stessa cosa quando deve decidere la classe, invece ora mi trovo che quando chiude l'help ritorna al punto in cui deve immettere il nome del PG. - Un'altra cosa che sto facendo è la pagina con i comandi, magari qui posto il codice che avevo usato con Godot in cui usavo un match con la lista delle parole, poi una prima parola per definire l'azione da compiere e una seconda parola se si aveva bisogno di tipo parlare con un NPC specifico o altre azioni come usare, prendere, lasciare, ecc forse sono un po' troppo ambizioso 😛223Views0likes0CommentsYou can put classes as return values and arguments in pointer functions in gcc/clang atleast
I’m currently working on a messaging library after an incident for my git, but hope this helps. It.. can cause appt of seg faults i think you Can do class T(int x) { func cout x++; } // class function oop for pfunc, C Main() { T (*pfunc)(int, T); T *n = new T(blah) pfunc = &C; pfunc(id, T); } hope this helps!! Have fun Microsoft… and please buy from a good vendor201Views0likes0Comments