0 votes

I'm trying to do something very similar to:

https://www.adaxes.com/questions/10758/copy-image-uploaded-binary-custom-attribute-network-share

but rather than uploading the M365, uploading to a specific SharePoint folder with the photo file named as the user account's sAMAccountName.

If I could save the photo as an image file I could then use PnP.PowerShell to upload it, but I'm stuck on this step.

I have Adaxes version 3.16.21627.0

by (190 points)

1 Answer

0 votes
by (294k points)

Hello,

The approach will be the same, where you will need to save a picture to a custom Binary attribute. In the script, you will use the below code to obtain the attribute value and then you can proceed with saving it to a SharePoint folder as a file.

$copyFromPropertyName = "adm-CustomAttributeBinary1" # TODO: modify me

# Get the picture
try
{
    $photoBytes = $Context.TargetObject.Get($copyFromPropertyName)
}
catch
{
    $Context.LogMessage("No picture specified in attribute $copyFromPropertyName.", "Warning")
    return # No picture
}

Unfortunately, we do not have any scripts for saving the contents of a Binary attribtue to a file, but the following thread might be helpful: https://stackoverflow.com/questions/926935/rails-saving-the-contents-of-a-binary-field-to-a-file.

Related questions

0 votes
1 answer

Hi, in our Create User action we have setup a custom binary attribute to upload the staff picture. Is there a way to save the uploaded image to a network share and rename ... out how to save the uploaded image to the share with proper file name. Thank you.

asked Apr 29, 2021 by TJ_Umredkar (140 points)
0 votes
1 answer

By default when you upload a user photo to Adaxes, it converts it to less than 100kb for Active Directory, that photo is synced to Azure AD, and once and only ... older script that could grab the photo before the compression to 100kb, ideally after cropping?

asked Jun 16, 2020 by ethanthekiwi (30 points)
0 votes
1 answer

Hi, I would like to add a CSV file during my group creation form and add users from CSV to new created group. However the CSV file is converted into Binary file and I am ... help is really appreciated. Thanks! PS: What I tried so far and error message I got

asked Jul 3, 2023 by wintec01 (1.5k points)
0 votes
1 answer

Hello, Could you help me with a script to save the picture attribute from a targeted user to a temporary jpg file named employeeid.jpg, and then move that jpg to a network file share? Thanks so much! Ryan

asked May 21, 2014 by ryan_breneman (920 points)
0 votes
0 answers

Good morning, I need to export in excel custom attribute from user in one row. Like this: columns: DisplayName,Email,%adm-CustomAttributeDate10%(Friendyname),%adm- ... create the report correctly with the columns and rows formatted. Any suggest? Thanks

asked Apr 8, 2022 by Simone.Vailati (430 points)
3,588 questions
3,277 answers
8,303 comments
548,077 users