I have one sharepoint link contains username and i want to take that username which is dynamic from sharepoint link.
Ex. Here is the sample sharepoint link.
Suppose to get current username we can use - Environment.UserName.ToString
like what we use to get username from sharepoint link.
You can use Regex for that as below
Now you can use split function as below
URL = “https://abc-my.sharepoint.com/personal/userfirstname_userlastname_euroclear_com/Documents/Documents/Test2.xlsx?web=1”
URL.split("“c)(0) → Firstname
URL.split(”"c)(1) → lastName
Hope this will help you
You can use Named Groups in regex to extract the first and last name from your example link.
Here is how it looks
More about how to extract value from Named Groups : Regex help tutorial MEGAPOST