asp.net - Get the ID? of the current user like SharePoint can? -


i'm @ client site have application began in sharepoint , migrating away custom asp.net application. of data elements still hosted within sharepoint lists, 2 of in question "notes" , "tasks" (fairly simple data elements in sharepoint setup, nothing special them). 1 of things need able within asp.net automatically create new items these lists , add them code.

so far it's pretty easy. found existing web part handled editing items, attached debugger it, tracked how got values , added list, etc. however, 1 of fields being added list item isn't quite obvious. in existing web part ui, field looks this:

assigned field

essentially, it's field entering user current windows domain. book icon opens pop-up allows user search name, etc. in current testing, i'm running local administrator on development machine. "admin" in pop-up , populates field "[machine name]\administrator" expected. then, in debugging, value gets pulled field , entered sharepoint list item "1" opposed name or that.

i assume "1" identifier local admin account. makes sense, after all. question is, how can identifier current logged-in user in code? i've found code current user's name, not kind of numeric (even though it's string) id.

additionally, wouldn't happening inside of asp.net application context. there's wpf client application laptops generating these list items , synchronizing them server when connected. i'm operating on assumption client user logged in proper domain account known server.

i imagine pretty easy, haven't stumbled across need quite yet.

i suppose you're looking this:

int userid = spcontext.current.web.currentuser.id; 

by way, internal id assigned sharepoint user. id wpf application, deploy webservice inside sharepoint return id. or can query sharepoint database, i'm not sure if it's safe :-)


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -