Translate

Wednesday, September 16, 2015

SharePoint 2013 - Cannot Delete or Save Documents

Working on the new SharePoint 2013 and we were running into different issues. Could not save or delete documents and we received the following "Unexpected response from server. The status code..." error when replying on a list/discussion.
Looked like a permissions or authentication problem to me. Doing a trace after a save or delete I saw that it was cycling between the HTTP request and redirect to login. Changing the authentication settings on the site in IIS fixed the problems.

SharePoint - Set Trusted Root Certificate

The SharePoint sight was not displaying, there was just a blank page and no errors. I looked at the log using the ULS Viewer and found an error message "An operation failed because the following certificate has validation errors...". To fix the problem I had to add my SSL certificate as a Trusted Certificate using the Certificate Manager Snap-in in the MMC. This site has a simple explanation on how to do it.

Monday, September 14, 2015

SharePoint - Map Missing AD Attribute to User Profile Property

There are a few Active Directory Attributes that are not listed on the "Add User Profile Property" page. To add a missing attribute you have to first add a user profile property that uses any attribute from the attribute list and then modify the entry using the SharePoint Management Shell. You need to run the Management Shell with a user account that will have right permissions or you will run into errors.
The following is an example of the script:

# Richrd Golebiowski
# January 12, 2012
# Run in Sharepoint Managemnt Shell as SP_Farm
$url = "http://myssp:1000" #URL of your Central Admin site.
$spsProperty = "PostOfficeBox” #Internal name of the SharePoint user profile property
$fimProperty = "postOfficeBox” #Name of the attribute in FIM/LDAP source
$connectionName = “Ad Primary Connection” #Name of the SharePoint synchronization connection

$site = Get-SPSite $url

if ($site)
{Write-Host “Successfully obtained site reference!”}
else
{Write-Host “Failed to obtain site reference”}

$serviceContext = Get-SPServiceContext($site)

if ($serviceContext)
{Write-Host “Successfully obtained service context!”}
else
{Write-Host “Failed to obtain service context”}
$upManager = new-object Microsoft.Office.Server.UserProfiles.UserProfileConfigManager($serviceContext)

if ($upManager)
{Write-Host “Successfully obtained user profile manager!”}
else
{Write-Host “Failed to obtain user profile manager”}
$synchConnection = $upManager.ConnectionManager[$connectionName]

if ($synchConnection)
{Write-Host “Successfully obtained synchronization connection!”}
else
{Write-Host “Failed to obtain user synchronization connection!”}

Write-Host “Adding the attribute mapping…”
$synchConnection.PropertyMapping.AddNewMapping([Microsoft.Office.Server.UserProfiles.ProfileType]::User, $spsProperty, $fimProperty)
Write-Host “Done!”

I tried running the script with my personal admin account instead of the farm account and ran into a lot of errors. The most interesting was executing "new-object Microsoft.Office.Server.UserProfiles.UserProfileConfigManager($serviceContext)" would set "$upManager" and then show "Successfully obtained user profile manager!" but the ConnectionManager would be empty and I would get a "Cannot index into a null array." error when executing "$synchConnection = $upManager.ConnectionManager[$connectionName]"

Wednesday, September 9, 2015

Spring - Using @Async to execute methods asynchronously

I have a long running database update that was added to a web application. Didn't seem right to have a method running for so long with the final result being a "Success!" message on the web page and no feedback to the client in the meantime so I made the method run asynchronously using Spring @EnableAsync and @Async. You can get my Eclipse test web application at Git Project.

Wednesday, September 2, 2015

Unit4 Agresso - Re-queue IntellAgent Events

Due to a network problem that affect SMTP we had a few IntellAgent Events that timed out. So the e-mails associated with them did not get sent. I figured out a script that would re-queue the events so that the e-mails would get sent.
My script:

begin tran
INSERT INTO [dbo].[ainqueue]
   ([alert_user_id]
   ,[destination]
   ,[error_count]
   ,[event_id]
   ,[instance_id]
   ,[last_update]
   ,[output_id]
   ,[output_seq]
   ,[output_type]
   ,[result]
   ,[sort_order]
   ,[status]
   ,[user_id])
SELECT [alert_user_id]
  ,[destination]
  ,0
  ,[event_id]
  ,[instance_id]
  ,[last_update]
  ,[output_id]
  ,[output_seq]
  ,[output_type]
  ,''
  ,[sort_order]
  ,'N'
  ,[user_id]
  FROM [dbo].[ainlog]
  where  error_count = 5 AND last_update > '8/31/2015'
  delete  FROM [dbo].[ainlog]
  where  error_count = 5 AND last_update > '8/31/2015'
  commit tran

The script copies the event information from the event log table, ainlog, to the event queue table, ainqueue and then deletes the records from the log table. The events need to be deleted from the log table so that the log for the events that we just queued up get recorded when they are executed. If yo do not delete the log records the new log record will not get written because of a constraint on the table and this will prevent the queue record from being deleted which will cause the event to be ecxecuted again and anothere e-mail sent the next time the server process runs.

Note: Your TSQL from clause will need to be set to select the correct records in your particular situation.