Hot answers tagged

16

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 ...


12

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

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 ...


9

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


8

Getting only the current user won't be enough to get user profile properties. You need to use the PeopleManager as well. Your code should look something like this: var context = SP.ClientContext.get_current() var web = context.get_web(); var user = web.get_currentUser(); var peopleManager = new SP.UserProfiles.PeopleManager(context); var personProperties = ...


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 = 950;...


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 SPSite("http://...


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

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.


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)) {...


5

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


5

You can query SiteUserInfoList to get all users in a site. ClientContext clientContext = new ClientContext("http://your site/"); Web web = clientContext.Web; List siteUserInfoList = web.SiteUserInfoList; CamlQuery query = new CamlQuery(); query.ViewXml = ""; ...


5

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


5

Extensive explanation, tutorial, etc.: Find Number of Users Currently Logged on to a SharePoint Site The gist of it is that you don't have OOTB features to show you the number of currently logged in users. You can check IIS for current users, but you don't know whether these are logged on or not. The solution explained in the blog article is to ...


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

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

This is what I have been using to get an SPFieldUserValue from the resolved users and groups in a PeopleEditor control. public static SPFieldUserValue GetPeopleFromPickerControl(PeopleEditor people, SPWeb web) { SPFieldUserValue value = null; if (people.ResolvedEntities.Count > 0) { for (int i = 0; i < people.ResolvedEntities.Count;...


4

the sub sites by default inherit permission from the parent site. you can go to --> Site Setting --> Site permissions of your sub site i.e sub_subsite1 and click on stop inheriting Permission and add your user to that site.also remove the user from the parent site.the user can access only the sub site.


4

Here you go: <script type="text/javascript" src="/_layouts/js/jquery-1.11.0.js"></script> <script type="text/javascript" src="/_layouts/js/jquery.SPServices-2014.01.js"></script> <script type="text/javascript"> $(document).ready(function(){ isGroupMember("Your User Group", function(result){ if(result){ //do something } }); }...


4

Nico, I found a source that may help you immensely. The following link walks you through how to use a PowerShell script to import a list of users from Excel and create them for FBA. Importing and Exporting Data in Extranet Collaboration Manager (ExCM) 2010 You can also download the PowerShell source code from this link. It looks like the code creating ...


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: http://msdn.microsoft.com/en-us/...


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 ...



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