How to get owner name in a dataset with code repo from the RID?

Hello,

I would like to extract the owner name in code repo from the RID.

Please can we explaire how can i do ? Thanks

Hi. You could use something like this.

@Function()
    public async getFullName(userId: string): Promise<string> {
        // Fetch the user object using getUserByIdAsync
        const user: User | undefined = await Users.getUserByIdAsync(userId);

        //Check if the user exists and if the name is defined
        if (!user || !user.firstName || !user.lastName) {
            throw new UserFacingError('Something went wrong.');
        }

        // Return the user's given name
        return user.firstName + " " + user.lastName;
    }

Hello,
Thank you for your feedback.
I see in your suggestion that I need to manually enter the userID. However, what I actually need is the following: I have a dataset, and I need to retrieve the owner name of this dataset using its RID.
Maybe I first need to retrieve the RID, and from that RID get the owner name?
Please can we clarify this point in a code repo or typescript function ? thanks