URLDownloadToFile() is now a 4 letter word. It is identified as a virus – time to find a diff. way to download from SharePoint

I was quite miffed that Malwarebytes identified my code as a virus. I had some Excel VBA macros that downloaded files from sharepoint in a fractoin of the time compared to opening them as a file from SharePoint. Brilliant … until “MalwareBytes just saved your life by killing Excel for you before you were doomed forever” … but … but hey – my program just poof … gone. Changes, long macro (that during VPN/Covid days) takes forever and now … gone. After some debugging it was the line URLDownloadToFile that paused Excel for about 4 minutes before then caused MalwareBytes to kill it. I did put in a ticket (and expect it to never be addressed) but suggested that if a file is in the trusted sites list – perhaps don’t view that as an exploit. It is likely faster to re-program things.

Suggestions online only have 3 options to download from SharePoint.

  • map a drive, use the drive (and optionally kill the drive mapping). This seems lame. Plus you are opening a file using Explorer type access – which I said was slow
  • Use URLDownloadToFile() which – EVERYONE IS USING – that is why it is likely why people who make viruses use it – it seems to be quite popular with Virus developers
  • REST – way to complicated – no one has done it without asking for usernames and passwords everytime (I did figure it out – and this is how I am doing it now)

Alas – I DID figure out the bits and pieces to NOT as for credentials and to camp-out on an existing connection to SharePoint. I am doing this from an Excel VBA macro – so we are 99% guaranteed that we are connected. Complicated – you have no idea – YES IT IS.

Here is my journey:

Continue reading

Reduce delay of seeing drives as “active” and ready after switching to/from VPN

It sure takes many moons to see your drives if you switch to and from a VPN. We developed a switching app that maps drives to sharepoint or the VPN. After some digging around – i found a powershell script that did a System.IO.DriveInfo() command which seemed to delay things for a small amount but the drives became active right away. Cool I said. So i then modified it to do a

  • netuse then
  • System.IO.DriveInfo() then do a
    • and print out the status of each drive
    • and finally
  • netuse (to see any changes)

It seems to work. The “ah ha” moment came from when I tried this program from this guy. I have since morphed it into function that accepts the drive letter and the \\server\share path and does a netuse in front and in back.

Data Science: Deep Learning in Python Notes

Section 2 – Review Notes

Sadly I can’t publish my notes here – as that would be a copyright infringement, but here are some supplementary links i don’t want to lose that help me get my graduate and undergraduate reviewed. I am putting this towards my PEng continued learning credits. Cool to be back in school. Love this stuff.

SharePoint and BlueBeam Revu – open in browser, native – what gives? Solved.

What a dizzying nightmare. First, web browsers NOW have a built in PDF capabilities so most people don’t have to install a 3rd party PDF viewer like Adobe or Nitro. I install these 3rd party PDF viewers on PC’s Mac OS X – but for heaven’s sake – don’t allow it to be the default on a Mac. Just don’t.

But for PC’s if you use Bluebeam for PC’s as your PDF viewer and the source of those PDFs is SharePoint – there are >5 layers of setting to consider and each browser has its quirks. Want to skip to the recommendation (which is just “live with it and learn how”? click here)

Continue reading

Get Started w SharePoint PnP (Patterns and Practices) and getting over install issues

Simple – go to this website and type the commands to install a new powershell. Well – in Microsoft fashion – not quite that simple. First running the PowerShell commands needs one to DOWNGRADE the allowed SSL to Tls1.2 on the powershell first. Then … you can get going.

  1. Open Powershell as an admin (right mouse click on it and choose Open as Administrator)
  2. Then type
    [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
  3. Then follow the steps in the main article. I chose all the default options as I am using Sharepoint Online

Invoke-Expression (New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/sharepoint/PnP-PowerShell/master/Samples/Modules.Install/Install-SharePointPnPPowerShell.ps1')

NOW we can rock out. This article mainly helps me over the hump of the proper Tls1.2. Where next? I am going to write my first SPFx Sharepoint Foundation web part – cause they took my old WebParts away for use on the Modern UI pages in Sharepoint 2016 and Online. Kindle to the rescue with the book called Mastering Sharepoint Framework: Master the SharePoint Framework Development with Easy-to-Follow Examples

Making Soap Requests still works on SharePoint Online

I was getting individual fields from a Sharepoint List and the SOAP request (old code) needed the viewId (a GUID) and it took a long time to find it. It is quite easy to find (now that I found it once) but if you go to the classic view and click Library->ModifyView and scroll all the way to the bottom-right – you will see your viewId in url-encoded text at end of the URL. Done. Its tricky to know what GUID was being sought and it wasn’t on my blog – so it took longer. Never again 😉 You can stop reading but below is the context in which the viewId is needed.

Continue reading

Make an Accordion content in Sharepoint

You have to get script access added by the admin – so for one client I had to beg for it – but since jQuery is part of Sharepoint – all we do is add some code and it makes the items between <h2> tags appear and disappear. Add a little more CSS to get a + and – added to the right and we are good to go. I would use a different <hX> or make my own – but Credit goes to this guy:

https://info.summit7systems.com/blog/how-to-create-dynamic-accordions-in-sharepoint-pages

QR Codes from googleapis

Bitly accounts have no QR ability – mental – must be a paid version or a royalty thing. Anyways – type this in to any browser and you instantly can download a QR code png. First change the last part to your own short code. Instructions are here for other options.

https://chart.googleapis.com/chart?cht=qr&chs=177×177&chld=H&choe=UFF-8&chl=https://myShortCode.com/12345

BUT – that can’t be read from an iOS device camera taking a pic or clicking on a web page. So here is a text version so you can copy it easier:

https://chart.googleapis.com/chart?cht=qr&chs=300×300&chl=https://myShortCode.com/12345

Console App for Sharepoint Online with MFA turned on.

Customers suggesting a deployment on a Friday (click for credit)

First, I couldn’t write the title until I got to a) the correct example online, then b) the proper credentials (a work-mate(s) hinted towards the answer) and c) the exact exception text “The sign-in name or password does not match one in the Microsoft account system.”

Sharepoint – as usual … SUPER FOR CONTRACTORS WHO GET PAID THE HOUR. (argggg).

Continue reading

Raspberry PI must-have’s

So I set up 2 Raspberry PI’s in the past week as a friend of mine needed something to do DDNS. I have not completed an Arduino DDNS but I have been comfortable with the PI. I wondered why the price went up in til I realized that the new RPI 3 B+ has wireless and bluetooth now. Nice – and not sure why the name didn’t change :-). Some must have’s I have found are:

  • enable SSH and/or VNC – can even do config via ssh in a console like way!
  • An off switch via a paperclip – this made me laugh and I reviewed the code. Slick! So put a screw in the official package I gave back to my friend as the off switch (short last 2 pins on GPIO)
  • A reboot every week (not necessary but the place I am putting this is 2 hours away – so if any memory leaks etc. occur – I want it to work – can you tell I use Windows for a living?) It is super stable but it needs a reboot still every 3 weeks or so
  • turn the time-sync on – there is no battery so it can go off time

I didn’t want to lose these links so I made an article. Also how to setup no-ip ddns which is super easy – plus I found Snotty Ron’s Cupcake recipe and the Snotty Ron commercial which I must share.