Tuesday, 23 July 2013

SharePoint 2010: Why can I see the 'Alert Me' button on the ribbon?

Setting up an Alert in SharePoint is very easy, but not if you cannot find the 'Alert' button.

The button will only be displayed if you have an outgoing SMTP configured.

Go to Central Admin -> System Settings -> Configure outgoing e-mail settings.

Once the SMTP server is configured, the Alert option will appear in the ribbon

Monday, 22 July 2013

Send an Email form PowerShell using Google SMTP

The following code snippet will send an email from PowerShell using Googles SMTP server.

$EmailFrom="blah@gmail.com"
$EmailTo = "blah2@uxceclipse.com"
$Subject = "Test"
$Body = "Test Body"
$SMTPServer = "smtp.gmail.com"
$SMTPMessage = New-Object System.Net.Mail.MailMessage($EmailFrom,$EmailTo,$Subject,$Body)
$SMTPClient = New-Object Net.Mail.SmtpClient($SmtpServer, 587)
$SMTPClient.EnableSsl = $true
$SMTPClient.Credentials = New-Object System.Net.NetworkCredential("blah@gmail.com", "Password");
$SMTPClient.Send($SMTPMessage)

SharePoint 2013 Developer tools

While wading through the Internet looking for useful SharePoint information, I can across this post with some interesting tools for SharePoint 2013.

http://www.sharepointcolumn.com/edition-5-sharepoint-2013-developer-tools/

Remove a SharePoint column in PowerShell

I was trying to remove an existing column from a list through the UI without any success. The solution lay in removing it through the 'back end' with my good friend PowerShell.

Here is the code:

$web = Get-SPWeb -identity http://your/site/name
$list = $web.Lists["Your List Name"]
$column = $list.Fields["Your Column Name"]
$column.Hidden = $false
$column.ReadOnlyField = $false
$column.Update()
$list.Fields.Delete($column)

Thursday, 11 July 2013

SharePoint email address column validation

I was looking for code to validate a list column as an email address. I came across this post ( thanks Chris Kent ) which gave me the answer:

=AND(
ISERROR(FIND(" ", [Email],1)),
IF(ISERROR(FIND("@", [Email],2)),
 FALSE,
 AND(
ISERROR(FIND("@",[Email], FIND("@", [Email],2)+1)),
 IF(ISERROR(FIND(".", [Email], FIND("@", [Email],2)+2)),
 FALSE,
 FIND(".", [Email], FIND("@", [Email],2)+2) < LEN([Email])
 ))) )

Its a little piece of magic ....

Tuesday, 9 July 2013

Operation aborted (Exception from HRESULT: 0x80004004 (E_ABORT))

This error is caused by a SQL Server log getting too large.

The solution is to shrink to offending database.

Or, if you are like me and have a SQL Server 2008 database for development, run the following script:

exec master..sp_msforeachdb 'ALTER DATABASE [?] SET RECOVERY SIMPLE; DBCC SHRINKDATABASE ([?], 1); ALTER DATABASE [?] SET RECOVERY FULL;'

Thursday, 4 July 2013

Visual Studio 2008: The language-neutral solution package was not found

I removed a WSP from the solution store and tried to redeploy my code through Visual Studio 2008. I encountered the following error:

The language-neutral solution package was not found.

I am not sure of the cause - but I do know how to fix it: Close Visual Studio and reopen it.

Old school, but effective.

SharePoint 2007: This solution contains two assemblies with the same name, or the SharePoint server already has an assembly with the specified name

I have been working on a MOSS deliverable for a new client. I configured my Debug properties of the project to point to the target web application, but when I press F5, I get the following message:

This solution contains two assemblies with the same name, or the SharePoint server already has an assembly with the specified name

After a bit of investigation, I found the culprit - I had added a post build event to push the dll into the GAC.

"C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\gacutil.exe" -i "$(TargetPath)"

This meant that Visual Studio 2008 was finding an assembly in the GAC when it was not expecting to find one.

The resolution was:
1. Remove the dll from the GAC
2. Remove the post build event

I could then rerun the deployment and continue fixing my code ....