Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
T

temuco

@temuco
About
Posts
11
Topics
5
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Find email-enabled public folders exclusively using "Microsoft.Office.Interop.Outlook"
    T temuco

    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 because subFolder.DefaultItemType returns the value Outlook.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 address orders@domain.tld. 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

    C# database com windows-admin help question

  • ASP.NET Core on Linux Web Space
    T temuco

    Thank you, I will ask. You're right, I hadn't thought about that.

    .NET (Core and Framework) asp-net question learning csharp php

  • Management of window coordinates and sizes for multiple screens of different resolutions
    T temuco

    Yes. I have looked into the subject more closely. Here I find that Windows always ensures that the dpi number remains the same with different scaling. To do this, Windows changes the number of pixels. Here is an example from my Dell XPS with 3840x2400 pixels: with a scaling of 175%, Windows calculates with a screen resolution of 2194x1371. This means that the scaling at this resolution remains 100% at 96 dpi. Nevertheless, our old software gets confused with this. I assume that it calculates the scaling factor internally incorrectly - actually, this should not be taken into account at all as long as Windows programmatically delivers a scaling of 100% at 96 dpi. Here is a programme code that shows me (and confirms) everything essential in the debugger:

    using System;
    using System.Collections.Generic;
    using System.Drawing;
    using System.Windows.Forms;

    namespace multimonitor1
    {
    internal class Program
    {
    static void Main(string[] args)
    {
    // Abrufen der DPI-Skalierung und Skalierungsstufe jedes Bildschirms
    List<(float, float, int)> screenDpiScales = new List<(float, float, int)>();

            while (true)
            {
                foreach (Screen screen in Screen.AllScreens)
                {
                    using (var form = new Form() { Bounds = screen.Bounds, TopMost = true })
                    {
                        form.Show();
    
                        Graphics g = Graphics.FromHwnd(form.Handle);
    
                        float	dpiX	= g.DpiX;
                        float	dpiY	= g.DpiY;
                        int		scale	= (int) Math.Round(dpiX / 96.0 \* 100);
                        
    					screenDpiScales.Add((dpiX, dpiY, scale));
                        
    					form.Hide();
                    }
                }
    
                // Ermitteln der Größe und Position der Anwendung
                int appLeft		= 0;
                int appTop		= 0;
                int appWidth	= 0;
                int appHeight	= 0;
    
                // Hier müssen die genauen Koordinaten der Anwendung in Bezug auf den Bildschirm ermittelt werden.
                // \*\*\* \[English\] The exact coordinates of the application in relation to the screen must be determined here. \*\*\*
    
                // Berechnen der Größe und Position der Anwendung auf jedem Bildschirm
                for (int i = 0; i < Screen.AllScreens.Length; i++)
                {
                    Screen screen = Screen.AllScreens\[i\];
    
    C# tutorial

  • Management of window coordinates and sizes for multiple screens of different resolutions
    T temuco

    Why do screen resolutions and DPI settings not matter? The windows are not created by .NET. But I have a window handle that I could use.

    C# tutorial

  • Management of window coordinates and sizes for multiple screens of different resolutions
    T temuco

    Hello "OriginalGriff" first of all, thank you for your post. With my poor English, I'll try to explain the problem a little better. We have an application that was programmed with SAL. SAL is a programming language developed by the Gupta company in the 90s. Gupta has a colourful history: first it was called Gupta, then Centura, later Unify and today it is owned by OpenText. As far as window management is concerned, SAL applications unfortunately only work correctly with one screen. Working with several different screens causes SAL applications major problems. Now SAL can integrate and use .NET DLLs developed with Framework 4.8. This is where I would like to start in order to take over the window management myself. I want to be able to determine and restore the window position and size of the SAL application on any screen, regardless of resolution and scaling. Thank you again and best regards René

    C# tutorial

  • Management of window coordinates and sizes for multiple screens of different resolutions
    T temuco

    Hello, first of all I just need a hint on how to approach this topic in the most sensible way. I have an older application that can only determine its coordinates correctly when it is running on only one monitor. Now the application needs to run in environments with multiple screens with different resolutions. Example: Notebook with 1920x1080 + 3840×2160 + 1920x1200 (main screen). In addition, screens with a scaling other than just 100% can be run (e.g. 175%). As you can see here, a colourful mixture. I would like to determine the exact position and window size of the program. I am primarily a backend developer, so I have never had anything to do with this topic before. For this reason, I am turning to you in the hope of getting a push before I go the wrong direction. Many thanks in advance and best regards René

    C# tutorial

  • ASP.NET Core on Linux Web Space
    T temuco

    With the help of a Udemy course I am learning ASP.NET Core MVC. The course is this one: https://www.udemy.com/course/aspnet-core-mvc-configuracion-e-implementacion-net-6/ I haven't finished it yet, but I already have a question: Is it possible to host the application on a Linux based webspace, where .NET Core is not installed and to make it worse, I don't have root permission to install it? On this webspace I can host Wordpress, Joomla, HTML+CSS etc. Is it possible to publish the ASP.NET Core MVC application in such a way, that everything that is needed is included? Thanks in advance for your help. René

    .NET (Core and Framework) asp-net question learning csharp php

  • ASP.NET Core on Linux Web Space
    T temuco

    With the help of a Udemy course I am learning ASP.NET Core MVC. The course is this one: ASP NET CORE MVC Configuración e Implementación (NET 6) | Udemy[^] I haven't finished it yet, but I already have a question: Is it possible to host the application on a Linux based webspace, where .NET Core is not installed and to make it worse, I don't have root permission to install it? On this webspace I can host Wordpress, Joomla, HTML+CSS etc. Is it possible to publish the ASP.NET Core MVC application in such a way, that everything that is needed is included? Thanks in advance for your help. René

    The Lounge asp-net question learning csharp php

  • C# Service: Error 1053: The service did not respond to the start or control request in a timely fashion
    T temuco

    OK, problem solved. The error message had driven me astray and I was looking in the wrong place for the cause of the error. Now I proceeded systematically step by step: at the very beginning, the service crashes without doing anything. The error was due to the "displayname" of the service - this may be maximum 80 characters long, while I used 110 characters. I didn't know that and the error message also said something completely different. Thanks for your help! The weekend is saved! René

    C# csharp help dotnet question announcement

  • C# Service: Error 1053: The service did not respond to the start or control request in a timely fashion
    T temuco

    Thank you. That's exactly what I did yesterday, but the error remained. I will try again, but now rested ;-)

    C# csharp help dotnet question announcement

  • C# Service: Error 1053: The service did not respond to the start or control request in a timely fashion
    T temuco

    Hello,

    I have a problem with a self programmed windows service for .Net 6 that inherits from BackgroundService:

    namespace WooComMesserschmidt
    {
    internal class Worker : BackgroundService
    {
    private readonly HttpClient Client = new()
    private string BaseAddress = string.Empty;
    private readonly IConfiguration Configuration;
    private string ConfigFile = string.Empty;
    private readonly Dictionary _ConfigPar;
    internal static Dictionary ConfigPar = new();
    private readonly ILogger _logger;

    	public struct LogInfo
    	{
    		public ILogger? Logger;
    		public string?			LogFile;
    
    		public LogInfo(ILogger? logger, string logfile)
    		{
    			Logger	= logger;
    			LogFile	= logfile;
    		}
    	}
    
    	public static LogInfo logInfo;
    
    	public Worker(ILogger logger, IConfiguration configuration, Dictionary configpar)
    	{
    		Configuration	= configuration;
    		\_ConfigPar      = configpar;
    		\_logger         = logger;
    
    		Init();
    	}
    

    ...

    In the method "Init()" relatively extensive tasks take place (on my PC it takes about 2 seconds). If these are through, it goes on here:

    protected override async Task ExecuteAsync(CancellationToken stoppingToken)
    {
    if (int.TryParse(ConfigPar[cpQueryInterval], out int QueryInterval) == false)
    {
    QueryInterval = QueryIntervalStd;
    Log.LogInformation(logInfo, $"Abfrageintervall konnte nicht ermittelt werden. Es wird daher der Standardwert von {QueryInterval} Millisekunden verwendet. Prüfen Sie die Angaben in der Parameterdatei.");
    }

    		Log.LogInformation(logInfo, $"{Process.GetCurrentProcess().ProcessName} gestartet.");
    		Log.LogInformation(logInfo, $"Worker arbeitet mit Abfrageintervall von {QueryInterval} Millisekunden.");
    
    		while (stoppingToken.IsCancellationRequested == false)
    		{
    			await ProcessNewOrders();
    
    			await UpdateProducts();
    
    			Dhl\_Polling();
    
    			await Task.Delay(QueryInterval, stoppingToken);
    		}
    	}
    

    ...

    The service is supposed to fetch orders from an eShop every few minutes, update items and process DHL shipments.

    Well, when I start the program manually in the command line (i.e. not as a service), everything works as expected. Now I have registered the program as a service and every time I try to start the service I get the following error:

    Error 1053: The service did not respond to th

    C# csharp help dotnet question announcement
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups