Vernal (Spring) Equinox 2024

Spring Equinox 2024

Spring starts now (03:07 UTC on March 20, 2024) in the Northern Hemisphere and Autumn for the equatorially challenged. The image above shows the precise moment of the equinox in Catfood Earth.

Add your comment...

Related Posts

You Might Also Like

(All Code Posts)

(Published to the Fediverse as: Vernal (Spring) Equinox 2024 #code #earth #equinox #spring #autumn #vernal The exact moment (03:07 UTC on March 20, 2024) of Spring Equinox 2024 rendered in Catfood Earth. )

MUC SFO

MUC SFO

Google Pixel 8 Pro 7mm f1.7 1/440s ISO21

LH458

Add your comment...

Related Posts

You Might Also Like

(Recent Photos)

(Published to the Fediverse as: MUC SFO #photo #plane #muc #sfo MUC SFO )

KRK MUC

Budapest

Budapest

Google Pixel 8 Pro 7mm f1.7 1/4s ISO88

Add your comment...

Related Posts

You Might Also Like

(Recent Photos)

(Published to the Fediverse as: Budapest #photo #budapest Budapest )

DXB BUD

DXB BUD

Google Pixel 8 Pro 7mm f1.7 1/20s ISO21

EK111

Add your comment...

Related Posts

You Might Also Like

(Recent Photos)

(Published to the Fediverse as: DXB BUD #photo #plane #dxb #bud DXB BUD )

BLR DXB

BLR DXB

Google Pixel 8 Pro 7mm f1.7 1/15s ISO165

EK569

Add your comment...

Related Posts

You Might Also Like

(Recent Photos)

(Published to the Fediverse as: BLR DXB #photo #plane #blr #dxb BLR DXB )

Download a Sharepoint File with GraphServiceClient (Microsoft Graph API)

Demons protect a PowerPoint presentation from developers trying to access it.

There is a stunningly simple way to get a file out of sharepoint and I'll get to that soon (or just skip to the very end of the post).

I have been automating the shit out of a lot of routine work in Microsoft Teams recently. Teams is the result of Skype and Sharepoint having too much to drink at the Microsoft holiday party. It often shows. One annoyance is that channel threads are ordered by the time that someone last responded. Useful for quickly seeing the latest gossip but a pain when you need to keep an eye on each individual thread. After listlessly scrolling around trying to keep up with the flow I came up with a dumb solution - I sync the channel to Obsidian (my choice of note app, could be anything) and then I can just check there for new threads. It's a small convenience but has meaningully improved my life.

Unfortunately I got greedy. These messages usually have a PowerPoint presentation attached to them and so why not have an LLM summarize this while updating my notes?

It doesn't look like Copilot has a useful API yet. You can build plug-ins, but I don't want to talk to Copilot about presentations, I just want it to do the heavy lifting while I sleep so I can read the summary in the morning. Hopefully in the future there will be a simple way to say hey, Copilot, summarize this PPTX. Not yet.

So the outline of a solution here is download the presentation, send it ChatGPT, generate a summary and stick that in Obsidian. This felt like a half hour type of project. And it should have been - getting GPT4 Turbo to summarize a PPTX file took about ten minutes. Downloading the file has taken days and sent my self esteem back to primary school.

You would think that downloading a file would be the Graph API's bread and butter. Especially as I have a ChatMessage from the channel that includes attachments and links. The link is for a logged in human, but it must be easy to translate from this to an API call, right?

It turns out that all you need is the site ID, the drive ID and the item ID.

These IDs are not in the attachment URL or the ChatMessageAttachment. It would be pretty RESTful to include the obvious next resource I'm going to need in that return type. No dice though.

I tried ChatGPT which helpfully suggested API calls that looked really plausible and helpful but that did not in fact exist. So I then read probably hundreds of blogs and forum posts from equally confused and desperate developers. Here is a typical example:

"Now how can I upload and download files to this library with the help of Graph API (GraphServiceClient)."

To which Microsoft, terrifyingly, reply:

"We are currently looking into this issue and will give you an update as soon as possible."

Before eventually suggesting:

"await graphClient.Drives["{drive-id}"].Items["{driveItem-id}"].Content.GetAsync();"

Ignoring the sharepoint part and glossing over where that drive ID is coming from. Other documentation suggests that you can lookup your site by the URL, and then download a list of drives to go looking for the right one. Well, the first page in paginated drive collection anyway implying that just finding the ID might get you a call from the quota police.

I know Microsoft is looking after a lot of files for a lot of organizations, but how can it be this hard?

It isn't. It's just hidden. I eventually found this post from Alex Terentiev that points out that you just need to base64 encode the sharing url, swap some characters around and then call:

"GET https://graph.microsoft.com/v1.0/shares/{sharing-url}/driveItem"

If Google was doing its job right this would be the top result. I should be grateful they're still serving results at all and not just telling me that my pastimes are all harmful.

The documentation is here and Microsoft should link to it on every page that discusses drives and DriveItems. For GraphServiceClient the call to get to an actual stream is:

"graphClient.Shares[encodedUrl].DriveItem.Content.GetAsync()"

Add your comment...

Related Posts

You Might Also Like

(All Code Posts)

(Published to the Fediverse as: Download a Sharepoint File with GraphServiceClient (Microsoft Graph API) #code #ml #graph #sharepoint #c# Everyone developing applications with the Graph API should know about the shares endpoint that allows you to download files easily. )

Links for March 2024

Updated on Saturday, March 23, 2024

FRA BLR

FRA BLR

Google Pixel 8 Pro 7mm f1.7 1/100s ISO21

LH754

Add your comment...

Related Posts

You Might Also Like

(Recent Photos)

(Published to the Fediverse as: FRA BLR #photo #plane #fra #blr FRA BLR )

SFO FRA

SFO FRA

Google Pixel 8 Pro 7mm f1.7 1/3,800s ISO21

LH455

Updated 2024-03-01 04:28:

SFO FRA

Northern Lights

Add your comment...

Related Posts

You Might Also Like

(Recent Photos)

(Published to the Fediverse as: SFO FRA #photo #plane #sfo #fra SFO FRA )