How to filter List or Library Attachments with CAML?

Hello Community,
I am using List or library control for getting files from user,
Now i have to filter this control, so the particular user can see only documents that they uploaded,
I know i can do this by lookup column. but i can not add any lookup as per our requirements,
so i am trying to filter list or library control,
i can get data regarding to user name using below query but i want to get data from email of user,
because in the system it may have multiple user with the same name and surname.

             <FieldRef Name='Author' />
             <Value Type='User'>love thakker</Value>

Does anyone have an idea how can i get the above filter user not comparing name but email?
i can not filter by the current user, i want to filter by email associate with created users profile.

I hope i explain well.
Thanks in advance.

Dear @harshp924,
Unfortunately, it's not possible to filter CAML query by user's email for Person or Group field.

If you only know the email, you can retrieve their name with pnpjs, and then filter by name as usual:

pnp.sp.web.siteUsers.getByEmail("[email protected]").get().then(function(user){
  var name = user.Title;
  fd.control('SPDataTable1').filter = "<Eq><FieldRef Name='Author'/><Value Type='User'>" + name + "</Value></Eq>";

Thanks @Nikita_Kurguzov, @mnikitina
I can use above one code to filter by user name but i dont want to like this, in case multiple users have same name and surname it will brock my functionality,

var userID = fd.field('Mytumlogin')._uid.toString();
dt.filter = "<Eq><FieldRef Name='Author' LookupId='TRUE' /><Value Type='Integer'>" + userID + "</Value></Eq>";  

Above code it i am useing to filter by UID, it works correct in my console, but whrn i try to get UID from people piker fields it gives same value all the time. I am now stuck into this....!
this does not give me answer because i can not get "_uid",
Please help me to filter it with User ID or some other way if possible.

Thanks Again, Have a good day...!

Dear @harshp924,
What about this?

var userID = fd.field('Person').value[0].uid;

Thanks @Nikita_Kurguzov for quick response,
it is not working as it gives value as undefined, it gives me object not Array, so...


i try below one, but it shows same value for all person value,


Thanks again.

Dear @harshp924,
Try this:

  var userID = user.Id;
  fd.control('SPDataTable1').filter = "<Eq><FieldRef Name='Author' LookupId='TRUE' /><Value Type='Integer'>" + userID + "</Value></Eq>";  

Thanks @Nikita_Kurguzov,
It works fine in New and Edit forms, in display form i can not get fd.field('Mytumlogin').value.Key, can you tell me reason behind it?
i can not get even email, i don't know why..?
Please provide feedback.

Thanks in Advance.

Dear @harshp924,
And if you try this?

var userID = fd.field('Mytumlogin');

this works for display form but not for edit/ new form. Isn't there any common way that works in all forms?

Dear @harshp924,
Unfortunately, doesn't seem this way right now. I'll talk to the dev team, see if we could expand properties on New/Edit forms to include the id as well.