Why are the binary attributes defined as "Int"?

Developer
May 24, 2011 at 10:44 PM

I am trying to use this client to set binary attributes such as Photo and ObjectSid in FIM but found out that these attributes were defined as "Int' in the client schema instead of "Byte[]".

What is the reason for that?

Does anybody has some sample code to set binary attributes in FIM?

 

Thank you

Developer
Jun 8, 2011 at 7:33 PM

I fixed this by changing the definition of ObjectSID and Photo to use RMbinary instead of Int.

I also had to tweak RMbinary a little bit.

 

I have not cheked in my changes though.

Developer
Jun 8, 2011 at 7:37 PM

Thanks Bahram,

It would be great if you could get those checked in for others to use.

-Jeremy

From: bahramr [email removed]
Sent: Wednesday, June 08, 2011 12:33 PM
To: jeremy@palenchar.net
Subject: Re: Why are the binary attributes defined as "Int"? [fim2010client:258873]

From: bahramr

I fixed this by changing the definition of ObjectSID and Photo to use RMbinary instead of Int.

I also had to tweak RMbinary a little bit.

I have not cheked in my changes though.

Oct 14, 2011 at 9:17 PM

Can i throw out a second request to check those changes in (or share them here)? 

Coordinator
Oct 19, 2011 at 7:19 AM

Bahram,

I added you as a developer, please contribute your changes so we can check them.

Thanks,
Paolo

Apr 27, 2015 at 9:34 PM
Hello,

I am working on the same issue,

I am trying to use this client to set binary attributes such as Photo in FIM but found out that these attributes were defined as "Int' in the client schema instead of "Byte[]".

I am writing a WCF service which upload a photo to the FIM but i having issues wit the attribute as it is int.
Here is my code:

public UploadedFile Upload(Stream Uploading)
    {
        int length = 0;
        UploadedFile upload = new UploadedFile { FilePath = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString()) };

        // This  shows the basic steps to modify a resource.
        using (DefaultClient client = new DefaultClient())
        {
            string filterName = "/Person[AccountName='" + HttpContext.Current.User.Identity.Name.Split('\\')[1].ToString() + "']";
            System.Security.Principal.WindowsImpersonationContext ctx = null;
            ctx = ((System.Security.Principal.WindowsIdentity)HttpContext.Current.User.Identity).Impersonate();

            //set credentials and refresh schema
            client.RefreshSchema();

            // get the person(s) object(s) to modify
            foreach (RmPerson person in client.Enumerate(filterName))
            {
                // create the object to track changes to the resource
                RmResourceChanges changes = new RmResourceChanges(person);
                try
                {
                    changes.BeginChanges();

                    //byte[] m_Bytes = ReadToEnd(Uploading);
                    //  person.Photo = Convert.ToInt32(m_Bytes.GetValue(0));

                    using (FileStream writer = new FileStream(upload.FilePath, FileMode.Create))
                    {
                        int readCount;
                        var buffer = new byte[8192];
                        byte[] fileContent = null;
                        BinaryReader binaryReader = new BinaryReader(writer);


                        while ((readCount = Uploading.Read(buffer, 0, buffer.Length)) != 0)
                        {
                            writer.Write(buffer, 0, readCount);
                            length += readCount;
                        }
                        // change something in the resource
                        person.Photo = binaryreader;
                    }

                    // modify the resource on the server
                    client.Put(changes);
                    // the operation succeeded: accept the changes.
                    changes.AcceptChanges();
                    // NOTE: after calling AcceptChanges the RmResourceChanges 
                    // object does not contain any more changes to propagate to
                    // the server.
                }
                catch (Exception ex)
                {
                    changes.DiscardChanges();
                }
            }
            upload.FileLength = length;
            return upload;
        }
    }
Can some one please post the solution to this issue? I need this ASAP.

Thanks,
Sravani
May 11, 2015 at 6:53 PM
Hello Bahram,

Can you please share those changes that you made on the RmBinary. I am also trying to upload the photo and i could not able to do.

Please help me.

Thanks in advance,
Sravani
May 11, 2015 at 6:55 PM
identitynotes wrote:
Thanks Bahram, It would be great if you could get those checked in for others to use. -Jeremy From: bahramr [email removed] Sent: Wednesday, June 08, 2011 12:33 PM To: jeremy@palenchar.net Subject: Re: Why are the binary attributes defined as "Int"? [fim2010client:258873] From: bahramr I fixed this by changing the definition of ObjectSID and Photo to use RMbinary instead of Int. I also had to tweak RMbinary a little bit. I have not cheked in my changes though.
Hello,

Can some one please help me wit the changes that you guys made. I am facing the same issue for photo upload.

Looking forward.

Thanks in advance,
Sravani