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

Iron 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.
 
4 Replies
Did you ever get a resolution to this?

somewhat related:

https://developercommunity.visualstudio.com/content/problem/174472/enum-fileattributes.html

 

from the linked resource:

[Flags]
enum FileAttributes : int
{
ReadOnly = System.IO.FileAttributes.ReadOnly,
Hidden = System.IO.FileAttributes.Hidden,
//System = System.IO.FileAttributes.System,
Directory = System.IO.FileAttributes.Directory,
Archive = System.IO.FileAttributes.Archive,
Device = System.IO.FileAttributes.Device,
Normal = System.IO.FileAttributes.Normal,
Temporary = System.IO.FileAttributes.Temporary,
SparseFile = System.IO.FileAttributes.SparseFile,
ReparsePoint = System.IO.FileAttributes.ReparsePoint,
Compressed = System.IO.FileAttributes.Compressed,
Offline = System.IO.FileAttributes.Offline,
NotContentIndexed = System.IO.FileAttributes.NotContentIndexed,
Encrypted = System.IO.FileAttributes.Encrypted,
IntegrityStream = System.IO.FileAttributes.IntegrityStream,
Virtual = 0x10000, // new
NoScrubData = System.IO.FileAttributes.NoScrubData,
RecallOnOpen = 0x40000, // new
RecallOnDataAccess = 0x400000 // new
}

+

Missing definitions:

Virtual = 0x10000
RecallOnOpen = 0x4_0000
Pinned = 0x8_0000
Unpinned = 0x10_0000
RecallOnDataAccess = 0x40_0000
SMR_BLOB = 0x????_????