The remote server returned an error: (401) Unauthorized: While uploading file in document library using App Based Token Authentication

I am trying to upload a document to the document library using App Based Token authentication in SharePoint Online.

I have referred following link to set up the App Based token and the token successfull worked when I try to read any thing from the site.

But when I try to upload a file using following code,

string file = @"Path Of the file"; System.IO.FileStream fs = new System.IO.FileStream(file, System.IO.FileMode.Open, System.IO.FileAccess.Read); using (var ctx = new AuthenticationManager().GetAppOnlyAuthenticatedContext(siteUrl, "CLIENTID","CLIENTSECRET")) {     try     {         ctx.Load(ctx.Web, p => p.Title);                      ctx.ExecuteQuery();                         Console.WriteLine(ctx.Web.Title);                      Microsoft.SharePoint.Client.File.SaveBinaryDirect(ctx, "RelativePathToDocumentLibrary" + "/test.docx", fs, false);                 }                 catch (Exception ex)                 {                 } } 

It gives me error of

{“The remote server returned an error: (401) Unauthorized.”}

Any suggestion or reference link is most welcome.

How to get deleted file when itemDeleted event fire in remote event receiver

How to get the deleted file when itemDeleted event fire in remote event receiver in SharePoint Online.

I have tried as follows but this does not work:

List photos = clientContext.Web.Lists.GetById(properties.ItemEventProperties.ListId); ListItem item = photos.GetItemById(properties.ItemEventProperties.ListItemId); string filename = Convert.ToString(item["FileLeafRef"]); 

Stop meta key activating host desktop in remote sessions

recent windows convert, so apologies if I’m not across a lot of the terminology.

I’m using Kubuntu 19.04 on my laptop, which is a mix of personal and work use.

When at work, most of my job is done in remote desktop sessions (RDC) on Windows servers.

Currently I’m using KRDC as my remote session client, but today I noticed the same problem working on a local QEMU/Virt-Manager VM.

When I am full screened in a remote session, and I press the Meta key (or windows key) in order to open the start menu on the remote session, the key press is being grabbed by my laptop OS. This results in the application launcher opening in Plasma, which pulls the session out of full screen. The key press is also being passed to the remote session, as the remote windows start menu will also open.

THis is obviously extremely disruptive, as it affects all meta+ shortcuts, such as opening the run command or explorer.

How can I prevent my laptop OS from intercepting and acting on the meta key presses when I am full screen in a remote session?

I’m not even sure where to start looking for answers, whether it’s application specific or a global keyboard setting. I’m also having trouble phrasing the problem in order to search.

Thank you for any help.

How to disable iMac infrared remote control?

I have successfully disabled my infrared remote on my iMac. Are these changes going to be overwritten with a future software update?

I have a fresh install of Ubuntu 19.04 on a stock Apple iMac 9,1 (24 inch, early 2009). Out of the box the computer responds to input from the Apple Remote. However, I have an Apple TV box in the same room so I want to disable the Apple Remote from the iMac.

Here’s how I solved the problem:

Add the following to /usr/share/X11/xorg.conf.d/10-quirks.conf to have Xorg ignore the infrared receiver:

Section "InputClass"         Identifier "Apple IR Receiver, disable"         MatchProduct "Apple Computer, Inc. IR Receiver"     Option "Ignore" "on" EndSection 

However, the login screen was still accepting input from the Apple Remote. After some digging, I determined that the login screen runs a program called gdm3 which by default launches Wayland for the display instead of Xorg. It is unclear to me how to configure Wayland in a similar way to Xorg to ignore the Apple Remote, so configure gdm3 to use Xorg:

Un-comment the following line of /etc/gdm3/custom.conf:


Now my iMac no longer responds to Apple Remote key presses both before and after login.

Xorg treats the Apple Remote as a keyboard, and it is possible to disable this keyboard using the xinput disable command, but that is only good for the currently logged in user and reverts after rebooting.

The USB devices on this machine:

$   lsusb Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 004 Device 003: ID 05ac:8215 Apple, Inc. Built-in Bluetooth 2.0+EDR HCI Bus 004 Device 002: ID 0a5c:4500 Broadcom Corp. BCM2046B1 USB 2.0 Hub (part of BCM2046 Bluetooth) Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 001 Device 003: ID 05ac:8502 Apple, Inc. Built-in iSight Bus 001 Device 006: ID 05ac:0304 Apple, Inc. Mighty Mouse [Mitsumi, M1152] Bus 001 Device 004: ID 05ac:021d Apple, Inc. Aluminum Mini Keyboard (ANSI) Bus 001 Device 002: ID 05ac:1005 Apple, Inc.  Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 003 Device 002: ID 05ac:8242 Apple, Inc. Built-in IR Receiver Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub