Home

Detect File Attribute for files on demand (PINNED/UNPINNED)

Highlighted
Marco Scheel
Contributor

We try to work with the attributes of files in OneDrive for Business on Windows 10 (1709). This article ha a great overview:

https://www.petri.com/managing-onedrive-files-demand-windows-10-fall-creators-update

This is a link that documents the attributes flags:

https://msdn.microsoft.com/en-us/library/windows/desktop/gg258117(v=vs.85).aspx

 

I don't find an exact representation of the pinned and unpinned attribute:

C:\Users\marcoscheel\OneDrive - Glück & Kanja Consulting AG\Transfer> attrib /?
Displays or changes file attributes.

ATTRIB [+R | -R] [+A | -A] [+S | -S] [+H | -H] [+O | -O] [+I | -I] [+X | -X] [+P | -P] [+U | -U]
[drive:][path][filename] [/S [/D]] [/L]

+ Sets an attribute.
- Clears an attribute.
R Read-only file attribute.
A Archive file attribute.
S System file attribute.
H Hidden file attribute.
O Offline attribute.
I Not content indexed file attribute.
X No scrub file attribute.
V Integrity attribute.
P Pinned attribute.
U Unpinned attribute.
B SMR Blob attribute.
[drive:][path][filename]
Specifies a file or files for attrib to process.
/S Processes matching files in the current folder
and all subfolders.
/D Processes folders as well.
/L Work on the attributes of the Symbolic Link versus
the target of the Symbolic Link

 

We want to interact with the files in C and/or C#.

 

This is a sample directory with files and the three states: screen.png

This is a LS on a folder with different files

Directory: C:\Users\marcoscheel\OneDrive - Glück & Kanja Consulting AG\Transfer
Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-----l      XX.XX.XXX     11:09        5386058 o365api.pbix
-----l      XX.XX.XXX     21:25          18325 test.docx
-----l       XX.XX.XXX 16:25      (3631219) When-To-Use-What-In-Office-365.pdf
This is the attribute as an int:
C:\Users\marcoscheel\OneDrive - Glück & Kanja Consulting AG\Transfer> get-item *.* | % { $_.Attributes }
ReparsePoint
525312
4199936
C:\Users\marcoscheel\OneDrive - Glück & Kanja Consulting AG\Transfer> get-item *.* | % { [int]$_.Attributes }
1024
525312
4199936
 
The system is capable to represent the cloud only file as a ReparsePoint, but the pinned and unpinned file are not matched. Is there an offical documentation regarding these "missing" flags.
 
Related Conversations