Thursday 24 November 2011

Create a complete content source with rule etc.

Get the search application

$searchapp = Get-SPEnterpriseSearchServiceApplication "Search application"

Create the content source

New-SPEnterpriseSearchCrawlContentSource -SearchApplication $searchapp -Type web -name IT -StartAddresses http://it

Add the inclusion rule

New-SPEnterpriseSearchCrawlRule -SearchApplication $searchapp –path http://it/* –CrawlAsHttp 1 -Type InclusionRule

And reduce the hit rate
New-SPEnterpriseSearchSiteHitRule myHost -Behavior 0 -HitRate 40

Ta Daaaaa!

 

Problems

I don;t know why but I never get on with Identity,

New-SPEnterpriseSearchCrawlRule -SearchApplication $searchapp -Identity http://it -CrawlAsHttp 1 -Type InclusionRule

   1: PS C:\Users\alman> New-SPEnterpriseSearchCrawlRule -SearchApplication $searchapp
   2:  -Identity http://it -CrawlAsHttp 1 -Type InclusionRule
   3: New-SPEnterpriseSearchCrawlRule : A parameter cannot be found that matches para
   4: meter name 'Identity'.
   5: At line:1 char:72
   6: + New-SPEnterpriseSearchCrawlRule -SearchApplication $searchapp -Identity <<<<
   7:  http://it -CrawlAsHttp 1 -Type InclusionRule
   8:     + CategoryInfo          : InvalidArgument: (:) [New-SPEnterpriseSearchCraw
   9:    lRule], ParameterBindingException
  10:     + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.Office.Server.S
  11:    earch.Cmdlet.NewSearchCrawlRule

found that using the path switch worked better:


New-SPEnterpriseSearchCrawlRule -SearchApplication $searchapp –path http://it/* –CrawlAsHttp 1 -Type InclusionRule

Wednesday 23 November 2011

Unable to Open Excel in Sharepoint 2010 "The workbook cannot be opened" Error

error

I’ve got this error , pretty much the same as everyone else.

WorkBookError

http://blogs.msdn.com/b/jjameson/archive/2010/05/04/the-workbook-cannot-be-opened-error-with-sharepoint-server-2010-and-tfs-2010.aspx

http://geekswithblogs.net/AmanGarg/archive/2011/04/23/unable-to-open-excel-in-sharepoint-2010-the-workbook-cannot.aspx

In the log as described I got the error

   1:  
   2: Insufficient SQL database permissions for user 'Name: BEILUX\svc_spdservice 
   3: SID: S-1-5-21-2123242984-1537360481-1219115889-45643 ImpersonationLevel: None' 
   4: in database 'WSS_Content_8080_DEV1_CORP_d3e5b5ca599743afba85046cee6e5a71' on SQL 



But just running the PowerShell did’nt work

$webApp = Get-SPWebApplication http://myServer

$webApp.GrantAccessToProcessIdentity("MyDomain\svc-spserviceapp
")
So I had to also grant dbo to the service user svc_spdservice. I know in the  jjameson blog it is not needed after the powershell but it was for me.
 

Tuesday 22 November 2011

TimerJob part 1

I’m trying to create a timer job and I know I’m going to make every mistake in the book, so here is mistake one :

When you create the empty SharePoint project do NOT choose sandbox or you get this error:

The type or namespace name 'SPJobDefinition' does not exist in the namespace 'Microsoft.SharePoint.Administration' (are you missing an assembly reference?)

oh and BTW this seems to be the best guide so far to create a timerjob

http://blog.sharepointupshot.com/posts/category/developmentguides/403/

Monday 21 November 2011

Colligo Contributor OutLook Add-In For SharePoint

Colligo outlook addin for SharePoint is a great product, how microsoft just did’nt do it properly in the first place is a mystery, but hey Colligo’s gain.

I’ve had a few problems with large lists, realy large lists ,12000 plus. I know MS say don;t go over 5k but…. Anyhoo you can look to see how Colligo keeps the data in a SQLite DB locally.

To improve performance I tried adding my own indeces, unfortunately it did not like it at all. In the end we found a way to bring the list size down.

If you want to look at the data yerself get SQL Lite browser from here:

http://sqlitebrowser.sourceforge.net/

then open up the Collgio DB which is usualy here :

C:\Documents and Settings\{current user}\Local Settings\Application Data\ColligoOfflineClient\Storage5

Then you can browse and see the list lookups.

Get A List Of Indexed Content Sources In SharePoint PowerShell

Want to see the list of SharePoint Search content sources on the command line with PowerShell?

$contentsource = Get-SPEnterpriseSearchCrawlContentSource -SearchApplication $searchapp
Get-SPEnterpriseSearchCrawlContentSource -SearchApplication $searchapp

Name             Id   Type                 CrawlState      CrawlCompleted
----             --   ----                 ----------      --------------
Local SharePo... 2    SharePoint           Idle            9/29/2011 10:16:0

http://instit... 26   Web                  Paused          11/17/2011 11:30:...
http://intran... 27   Web                  Idle            11/4/2011 8:24:28 PM
http://intran... 28   Web                  Idle            11/4/2011 8:30:38 PM
http://intran... 29   Web                  Idle            11/4/2011 8:27:08 PM
rp               30   Web                  Paused          11/17/2011 11:30:...


Friday 18 November 2011

OutLook Form Designer For the Clueless

To set one field with the value of another :

Sub CommandButton9_Click
  Set TextBox9 = Item.GetInspector.ModifiedFormPages("P.2").Controls("TextBox9")
  TextBox9.Text =  Item.GetInspector.ModifiedFormPages("P.2").Controls("TextBox1").Text
end sub

To create a new appointment do this :
Dim objOL 'As Outlook.Application
Dim objAppt 'As Outlook.AppointmentItem
Const olAppointmentItem = 1
Const olMeeting = 1
Const olFree = 0

Set objOL = CreateObject("Outlook.Application")
Set objAppt = objOL.CreateItem(olAppointmentItem)

objAppt.Subject = "My Test Appointment"
objAppt.Start = #8/19/03 3:50:00 PM#
objAppt.Duration = 1
objAppt.Location = "Followup"
objAppt.Body = "Test Verbiage"
objAppt.ReminderMinutesBeforeStart = 1
objAppt.BusyStatus = olFree
objAppt.Save()
Set objAppt = Nothing
Set objOL = Nothing
End Sub

( copied from http://www.pcreview.co.uk/forums/create-calendar-appointment-vbscript-command-button-t1836976.html )

but to display it before sending use objAppt.Display()   ( handy for debugging )


To display the current user:
Sub DisplayCurrentUser()
 Dim myNamespace 'As Outlook.NameSpace
 Set myNameSpace = Application.GetNameSpace("MAPI")
   Set TextBox4 = myNameSpace.CurrentUser
MsgBox myNameSpace.CurrentUser
End Sub
Also handy in there for debugging is the MsgBox.

when creating a new appointment though using the already filled in start and end on the screen

you cannot just do this :


    With objAppt
        .Subject = "My Test Appointment"
        .Start =  Item.GetInspector.ModifiedFormPages("P.2").Controls("TextBox1").Text
 ( BTW the start field is called TextBox1 ), you do that you get TypeMismatch: Cannot coerce parameter value. OutLook cannot translate your string  :


So what you have to do is substring it to get just the day/month/year eg
    With objAppt
        .Subject = "My Test Appointment"
        .Start =   Mid(TextBox9, 5, 10)

SharePoint Search: An efficient DDoS machine

Crawler Impact Rules in SharePoint PowerShell is :
New-SPEnterpriseSearchSiteHitRule -Identity myHost -Behavior 0 -HitRate 40

The TechNet article lists it:

Yet when you run it you get :
New-SPEnterpriseSearchSiteHitRule : A parameter cannot be found that matches parameter name 'Identity'.At line:1 char:44+ New-SPEnterpriseSearchSiteHitRule -Identity <<<< itwiki -Behavior 0 -hitrate2+ CategoryInfo : InvalidArgument: (:) [New-SPEnterpriseSearchSiteHitRule], ParameterBindingException+ FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.Office.Server.Search.Cmdlet.NewSearchSiteHitRule

If you remove the -Identity and just use :
New-SPEnterpriseSearchSiteHitRule myHost -Behavior 0 -HitRate 40

All is right, and on you go.