Keyword: User Profile Synchronization Service wont start
When configure user profile sync service, I get this error:
User Profile Application: SynchronizeMIIS encounters an exception: System.NullReferenceException: Object reference not set to an instance of an object.
at Microsoft.Office.Server.UserProfiles.UserProfileImportJob.<>c__DisplayClass2.<IsTimerJobRunning>b__1()
at Microsoft.SharePoint.SPSecurity.<>c__DisplayClass5.<RunWithElevatedPrivileges>b__3()
at Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode)
at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(WaitCallback secureCode, Object param)
at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(CodeToRunElevated secureCode)
at Microsoft.Office.Server.UserProfiles.UserProfileImportJob.IsTimerJobRunning(UserProfileApplicationJob timerJob)
at Microsoft.Office.Server.Administration.UserProfileApplication.SynchronizeMIIS()
at Microsoft.Office.Server.Administration.ILMProfileSynchronizationJob.Execute()
This is because the FIM certificate has not been validated yet. The farm account which the sync service is running under must have access to Internet. This validation only needs to be done once, after the certificate is validated, you can disconnect Internet.
Aaron C. Peng
Wednesday, 17 September 2014
Thursday, 11 September 2014
Error: "Not able to connect to search service to retrieve valid settings"
I tried to change the query of the search results webpart and I've got this:
Fix is to use the SharePoint management Shell and define your account as an SSA Admin.
Here's the code to add yourself as SSA admin:
$principal = New-SPClaimsPrincipal "<domain>\<user>" -IdentityType WindowsSamAccountName
$spapp = Get-SPEnterpriseSearchServiceApplication
$security = Get-SPServiceApplicationSecurity $spapp –Admin
Grant-SPObjectSecurity $security $principal "Full Control"
Set-SPServiceApplicationSecurity $spapp $security –Admin
Fix is to use the SharePoint management Shell and define your account as an SSA Admin.
Here's the code to add yourself as SSA admin:
$principal = New-SPClaimsPrincipal "<domain>\<user>" -IdentityType WindowsSamAccountName
$spapp = Get-SPEnterpriseSearchServiceApplication
$security = Get-SPServiceApplicationSecurity $spapp –Admin
Grant-SPObjectSecurity $security $principal "Full Control"
Set-SPServiceApplicationSecurity $spapp $security –Admin
Wednesday, 23 July 2014
Link multiple EditForms or DisplayForms to a sharepoint list
My listitems are opened via an infopath form. Client wants a second aspx form to open the listitems.
(the infopath form only shows a subset of the fields but the aspx form shows all fields).
When opening the aspx form, sharepoint redirects me to the infopath form. Somewhere, a redirect was taking place.
After a lot experimenting, I found that not only do you need hide the original List Form Web Part but you also need to set the ControlMode to Display. Here are the 2 lines of code that need to be modified in the original List Form Web Part:
Change:
<ControlMode xmlns=”http://schemas.microsoft.com/WebPart/v2/ListForm”>Edit</ControlMode>
To:
<ControlMode xmlns=”http://schemas.microsoft.com/WebPart/v2/ListForm”>Display</ControlMode>
Change:
<IsVisible>true</IsVisible>
To:
<IsVisible>false</IsVisible>
Monday, 16 June 2014
SharePoint 2013 Chrome Control Options
Looking through SP.UI.Controls.Debug.js, here are the options:
siteTitle
siteUrl
clientTag
appWebUrl
onCssLoaded
assetId
appStartPage
rightToLeft
appTitle
appIconUrl
appTitleIconUrl
appHelpPageUrl
appHelpPageOnClick
settingsLinks
language
bottomHeaderVisible
topHeaderVisible
siteTitle
siteUrl
clientTag
appWebUrl
onCssLoaded
assetId
appStartPage
rightToLeft
appTitle
appIconUrl
appTitleIconUrl
appHelpPageUrl
appHelpPageOnClick
settingsLinks
language
bottomHeaderVisible
topHeaderVisible
Friday, 13 June 2014
Get List Field Internal Name
You can get the internal name for a column by browsing to the List Settings > Edit Column and look at the QueryString. This will be url encoded but is a simple way of retrieving the internal name without writing any code. You will get something like:
/_layouts/FldEdit.aspx?List=%7B37920121%2D19B2%2D4C77%2D92FF%2D8B3E07853114%7D&Field=Product%5Fx0020%5FDescription
%5F is a '_'. The field name is Product_x0020_Description.
The code option is to use:
string itemInternalName = item.Fields["Field Display Name"].InternalName;
Thursday, 12 June 2014
Different ways to get user name using javascript
Get user email
_spPageContextInfo.userLoginName
Using REST Service
$(document).ready(function () {
var userid = _spPageContextInfo.userId;
function GetCurrentUser() {
var requestUri = _spPageContextInfo.webAbsoluteUrl + "/_api/web/getuserbyid(" + userid + ")";
var requestHeaders = { "accept" : "application/json;odata=verbose" };
$.ajax({
url : requestUri,
contentType : "application/json;odata=verbose",
headers : requestHeaders,
success : onSuccess,
error : onError
});
}
function onSuccess(data, request){
//var loginName = data.d.LoginName.split('|')[1];
var loginName = data.d.Title;
alert(loginName);
}
function onError(error) {
alert(error);
}
GetCurrentUser();
});
Using JSOM
$(document).ready(function () {
var currentUser;
// Ensure that the SP.js is loaded
if (SP.ClientContext != null) {
SP.SOD.executeOrDelayUntilScriptLoaded(getCurrentUser, 'SP.js');
}
else {
SP.SOD.executeFunc('sp.js', null, getCurrentUser);
}
function getCurrentUser() {
var context = new SP.ClientContext.get_current();
var web = context.get_web();
currentUser = web.get_currentUser();
context.load(currentUser);
context.executeQueryAsync(onSuccessMethod, onRequestFail);
}
function onSuccessMethod(sender, args) {
var account = currentUser.get_loginName();
var currentUserAccount = account.substring(account.indexOf("|") + 1);
alert(currentUserAccount);
}
// This function runs if the executeQueryAsync call fails.
function onRequestFail(sender, args) {
alert('request failed' + args.get_message() + '\n' + args.get_stackTrace());
}
});
Tuesday, 27 May 2014
SharePoint 2013: Get UserProfile Properties with REST API
Thanks to
http://www.vrdmn.com/2013/07/sharepoint-2013-get-userprofile.html
1) Get all properties of current user:
http://siteurl/_api/SP.UserProfiles.PeopleManager/GetMyProperties2) Get single property of current user:
http://siteurl/_api/SP.UserProfiles.PeopleManager/GetMyProperties/PictureUrlOR
http://siteurl/_api/SP.UserProfiles.PeopleManager/GetMyProperties?$select=PictureUrl
3) Get Multiple Properties for the current user:
http://siteurl/_api/SP.UserProfiles.PeopleManager/GetMyProperties?$select=PictureUrl,AccountName4) Get all properties of Specific User:
For Office 365/SharePoint Online:
http://siteurl/_api/SP.UserProfiles.PeopleManager/GetPropertiesFor(accountName=@v)?@v='i:0%23.f|membership|vardhaman@siteurl.onmicrosoft.com'
For SharePoint 2013 On-Premise:
http://siteurl/_api/SP.UserProfiles.PeopleManager/GetPropertiesFor(accountName=@v)?@v='domain\username'
5) Get Specific UserProfile Property of Specific User:
http://siteurl/_api/SP.UserProfiles.PeopleManager/GetUserProfilePropertyFor(accountName=@v,propertyName='LastName')?@v='i:0%23.f|membership|vardhaman@siteurl.onmicrosoft.com'
For SharePoint 2013 On-Premise:
http://siteurl/_api/SP.UserProfiles.PeopleManager/GetUserProfilePropertyFor(accountName=@v,propertyName='LastName')?@v='domain\username'
6) Get Multiple UserProfile Properties for Specific User:
http://siteurl/_api/SP.UserProfiles.PeopleManager/GetUserProfilePropertiesFor
Subscribe to:
Posts (Atom)