Tag Info

Hot answers tagged

15

Immediate Alerts timer job "Sends out immediate and scheduled alerts." the documentation says. However, immediate is controlled by a timer job which runs every five minutes by default. So in your case - the possible series of actions is: Create folder Create alert Now these two actions happened within the same 5 minute period, and when the timer job ...


10

According to How to set people and group column programmatically using Client Object Model this is how you set single user fields: SP.User _newUser = _ctx.Web.EnsureUser("domain\\username"); _ctx.Load(_newUser); _ctx.ExecuteQuery(); SP.FieldUserValue _userValue = new SP.FieldUserValue(); _userValue.LookupId = _newUser.Id; _listItem["userfield"] = ...


9

Yes _spUserId is deprecated in SP2013. Use _spPageContextInfo.userId instead.


7

There is a special element which is intended for use with multiple lookup fields: http://msdn.microsoft.com/en-us/library/ff630172.aspx Includes Element (Query) If the specified field is a Lookup field that allows multiple values, specifies that the Value element is included in the list item for the field that is specified by the FieldRef ...


7

There is this SP.UI.ModalDialog class (MSDN doku). With dialogOptions you can specify, how will your page behave after the user closes the dialog. function OpenMasterdataDialog(strPageURL) { var dialogOptions = SP.UI.$create_DialogOptions(); dialogOptions.url = yourPageWithDialogContent; dialogOptions.width = 750; dialogOptions.height = ...


6

Last year, Microsoft launched a dedicated site for SharePoint user adoption which can be a good place for you to start with. With addition to the above, I believe your prime concern should be planning a collaboration roadmap on SharePoint. This will essentially include high level areas like Current use of Office 2010 products within your organization and ...


6

You can try this if I understand you correct? Microsoft.SharePoint.SPContext.Current.Web.CurrentUser.LoginName; or HttpContext.Current.User.Identity.Name and Microsoft.SharePoint.SPContext.Current.Web.CurrentUser.ID; hope this helps :)


5

You also can use the SPUser and SPUserCollection Object to iterate through all user profiles using Microsoft.SharePoint; using Microsoft.Office.Server.UserProfiles; using Microsoft.Office.Server; using System.Web; here is the code: SPSecurity.RunWithElevatedPrivileges(delegate() { using (SPSite siteCollection = new ...


5

SharePoint is complex but the average user never even has to know what a web part is, so focus on the biggest bang for your buck. If 95% of the user base is just looking for a place to create lists or store documents, you can explain that in under 10 minutes. There are countless videos on the web that show this and there are even third party solutions that ...


5

Why don't you use a SPAlertHandler to change how alerts work for this list? Then you can decide when an alert is sent or not in C# code. http://msdn.microsoft.com/en-us/library/bb897791(v=office.14).aspx public override bool OnNotification(SPAlertHandlerParams ahp) { try { using (SPSite site = new SPSite(ahp.siteUrl + ahp.webUrl)) ...


4

You will need to load it from the User Profiles and not the SPUser object. SPServiceContext svcContext = SPServiceContext.GetContext(site); UserProfileManager profileManager = new UserProfileManager(svcContext); UserProfile profile = profileManager.GetUserProfile(accountname); string department = profile["department"].Value;


4

Both Get-SPDatabase or Get-SPContentDatabase powershell cmdlets retrun database GUID (among other attributes), if called without parameters, try to use it.


4

You can retrieve the system account by SPSite property SPContext.Current.Site.SystemAccount Basicaly EnsureUser method uses logon name (Domain\User_Alias) of the user.


4

In case any other internet wayfarers come by this problem; it's highly likely that this is due to the app-pool user being given the "Act as system" privilege in the Central Admin User Policy for the webapplication.


4

No, in my opinion it is not, unless you are using Form Based Authentication. In FBA, you could even have people themselves create their own users: anonymous user clicks Register, fills in a form with some essential information, a working e-mail address, and that's it. Basically, like you register yourself on most of the websites on the WWW. But if you are ...


4

Warning Depending on the number of documents you expect your users to store in SharePoint it sounds as if you're heading in the direction of disaster, by storing everything in the same Site in the same Site Collection. Answer to asked question You want to create an AD-Group for each department. You should then add all departments to the guest/visitors ...


4

You can filter folders from alerts, but it's a little tricky. Here's how I've managed to accomplish it. First, create a custom content type based on the Folder content type (I named it "Managed Folder" in this case). Add that to any lists you want to be affected and make sure it is visible in the "New" button. Remove folder creation from the list in its ...


4

This should return the current user: (Works for me here) Web web = clientContext.Web; clientContext.Load(web); clientContext.ExecuteQuery(); clientContext.Load(web.CurrentUser); clientContext.ExecuteQuery(); currentUser = clientContext.Web.CurrentUser.LoginName;


4

I do not think you can easily change the Site Definition that are used for creation of MySite personal sites. The normal approach is to use Feature Stapling, to push in your own features "on top" of the Site definition. The features can have for example Feature Receivers that change specific things, and modules that adds Lists, pages, branding files). Here ...


4

Move this line var groups = currentUser.get_groups(); To your getCurrentUser method and make sure to load it this.clientContext.load(groups); before executing the request, this way you will have it loaded in your success-function


4

You can use below code to extract the SPUser object string valueField2 = item[fieldID2].ToString(); SPFieldUserValue userField = (SPFieldUserValue)item.Fields[fieldID2].GetFieldValue(valueField2); SPUser user= userField.User; Now you can access all properties of SPUser Object Example user.LoginName


3

i guess you are looking for some api to resolve inputs. try this utility method: Microsoft.SharePoint.Utilities.SPUtility.ResolvePrincipal it will return a SPPrincipal object, witch contains a "LoginName" property. then you can use SPWeb.EnsureUser(loginName) to get a SPUser object. more infomation about this method: ...


3

I've managed to make this work by using the InfoPath userName() function then passing the value back to my workflow with the extended properties of the task the opened form is associated to. Not sure if this is the best (only?) way, but it works. Just one thing to be aware of. Some fields in the external properties are GUIDs so you might need the ...


3

NOTE: This solution doesn't work for Site workflows You can use this code snippet (Get current user in workflow sharepoint context (C#)) public static SPUser GetCurrentUserInWorkflow(Microsoft.SharePoint.Workflow.SPWorkflowActivationProperties workflowProperties) { string ModifiedbyUserName = ...


3

The closest you can get with default functionality is to impersonate a user and make a search with the user whose "linked" files you're interested in listing. Considering it is practically not possible to impersonate as each user, I would start off from this blog article and modify the code to be cross site collection and across all web apps. You could ...


3

As far as I know you will have to parse the XML. Its very easy to do string xml = @"<pc:Person xmlns:pc=""http://schemas.microsoft.com/office/infopath/2007/PartnerControls""> <pc:DisplayName>John Dodo</pc:DisplayName> <pc:AccountId>DOMAIN\john.dodo</pc:AccountId> ...


3

I started prototyping a similar solution. I had a centralized list that stored the point values for each type of action and then put event receivers on specified lists that calculated the points. The points can either be logged to SQL or another SharePoint list. If you want to do something based on visits versus an actual update you would need another ...


3

Was this windows account the same one with which SharePoint was installed? In that case, you could try to create a new user in AD and then login using the new user credentials.


3

Assuming your pages reside in a document library typically named as 'Pages' or 'Site Pages' what you need to do is go to manage permissions for the custom page and stop inheriting permissions. You need to give unique permissions to those pages and just grant users/groups whom you wish to make these pages accessible. That ways you can exclude group or a ...


3

I guess the most easiest way I know is to show it by JavaScript using SPServices. Look to SPServices documentation and examples for getting current user. This way allows to do that without extra server side codding. Sample: var thisUserName = $().SPServices.SPGetCurrentUser({ fieldName: "Title", debug: false }); Then put thisUserName where you need.



Only top voted, non community-wiki answers of a minimum length are eligible