SPSFAQ
SharePoint Server Frequently Asked Questions
affiliate links


Buy a sponsored link

You could have a link to your website on every page of SPSFAQ.


Customising SharePoint

SPSFAQ030156 - I want to build a personal search webpart. Where do I start? Salva - 0 Comments - stephencummins - Sun, May 19th, 2002 - Customisation
The search web part contains far too much for what you want. You better start with a new web part using the SPS CHTTPQuery object. We've included a code example to get you started.

Nikander Bruggeman
Margriet Bruggeman

Function GetContent(objNode)
Dim strResult : strResult = "<xml></xml>"
Dim strQuery : strQuery = Request.Form("Query")
Dim strUrl : strUrl = Request.Form("Url")
Dim objHq : Set objHq = New CHTTPQuery

If Len(strQuery) > 0 Then
objHq.IsAsync = True
' The last parameter indicates whether a content index
is used.
objHq.StartSearchQuery strQuery, 0, -1, -1, False
objHq.WaitForQueryCompletion
strResult = objHq.QueryResults
End If

GetContent = strResult
End Function
SPSFAQ030155 - Can I have a Quick links web part which open the links in a new browser window? - 0 Comments - stephencummins - Sun, May 12th, 2002 - Customisation
Here you go! Say thank you again to the omniscient Nikander Bruggeman & Margriet Bruggeman

http://www.spsfaq.com/downloads/Quick_Links.dwp
SPSFAQ030154 - How can I copy a file from one Workspace to another? - 0 Comments - stephencummins - Sun, May 12th, 2002 - Customisation
Dim oDocSource As New PKMCDO.KnowledgeDocument
Dim oDocTarget As New PKMCDO.KnowledgeDocument
Dim SourceDocumentURL as String
Dim TargetDocumentURL as String

SourceDocumentURL = "http://spsServer/workspace/documents/myDoc.doc"
TargetDocumentURL = "http://spsServer/anotherworkspace/documents/myDoc.doc"

' First save empty stream to target oDocTarget.DataSource.SaveTo TargetDocumentURL

' Open source and target document

oDocSource.DataSource.Open
oDocTarget.DataSource.Open TargetDocumentURL , , adModeReadWrite

' Copy source stream to target and flush stream

oDocSource.OpenStream.CopyTo oDocTarget.OpenStream
oDocTarget.OpenStream.Flush

'*** Here some field update etc.

' save target

oDocTarget.DataSource.Save



Pasi Heinonen
SPSFAQ030153 - How can I copy a file from my c: drive or local disk into SharePoint? - 0 Comments - stephencummins - Sun, May 12th, 2002 - Customisation
Here you are all you need (in VB) --coming from a sample of the SPS SDK

Option Explicit
'========================================================================
' Main
'
' This sample illustrates some of the useful things that one can do with the SharePoint Portal Server object model
'

' Upload a document
Dim sDocumentPath As String
Dim oDoc As PKMCDO.KnowledgeDocument

sDocumentPath = GetEnvironmentVariable("USERPROFILE") + _
"\My Documents\Document.doc"

Set oDoc = CreateDocument( _
sDocumentPath, _
sWorkspaceURL + "/documents/vehicles/document.doc", _
"urn:content-classes:vehicle")

' Set some metadata on it
oDoc.Title = "Vehicle sale document"
oDoc.Description = "This is a very useful document"
oDoc.Categories = Array(":Vehicles")
oDoc.Keywords = Array("Car", "Vehicle")
oDoc.Author = GetEnvironmentVariable("USERNAME")

oDoc.Property("urn:schemas-microsoft-com:office:office#VehicleType")
=
"Car"

oDoc.Property("urn:schemas-microsoft-com:office:office#VehicleName")
=
"Work car"

oDoc.Property("urn:schemas-microsoft-com:office:office#SaleDate")
=
#11/23/1999#

oDoc.DataSource.Save

' Publish the document
Dim oVer As PKMCDO.KnowledgeVersion

Set oVer = New PKMCDO.KnowledgeVersion
oVer.Checkin oDoc
oVer.Publish oDoc

Set oDoc = Nothing
Set oVer = Nothing

MsgBox ("Finished!")

End Sub

'========================================================================
' CreateDocument
'
' Description: imports a document to the server
'
' Arguments: attributes of the object:
' sFileStream - path to the file to be uploaded
' sHref - URL of the new document
' sCC - content class of the document
'
' Returns: the created document object




'========================================================================

Function CreateDocument( _
sFilestream, _
sHref, _
sCC _
) As PKMCDO.KnowledgeDocument

Dim oDoc As PKMCDO.KnowledgeDocument
Dim oStream As ADODB.Stream
Dim nIndex As Integer
Dim sPropName As String

Set oDoc = New PKMCDO.KnowledgeDocument

Set oStream = oDoc.OpenStream
oStream.Type = adTypeBinary
oStream.SetEOS
oStream.LoadFromFile sFilestream
oStream.Flush

If sCC <"" Then
oDoc.ContentClass = sCC
End If

oDoc.DataSource.SaveTo sHref, , , adCreateOverwrite

Set CreateDocument = oDoc
End Function

'========================================================================


Pierre VIVIER-MERLE
SPSFAQ030152 - How can I show all the categories and sub categories on one page? D Smith - 0 Comments - stephencummins - Sun, May 12th, 2002 - Customisation
Open up the categories web part, and edit the xsl code so that the "5" is changed to what you want and the "6" is changed to one more than what you want.

Step-by-step:
- Go to your categories dashboard
- Click "Content"
- Click on the Categories web part
- Click Advanced Settings
- click your mouse somewhere in the Embedded XSL area. Press CTRL-A
- Fire up vim, notepad, or your favorite text editor. Paste it in there
- Look for if expr="childNumber(this) &lt;= 5;"><TR><TD></TD><TD valign="center">
and replace the "5" with how many you want displayed.
- Look for if expr="childNumber(this) == 6;"><TR><TD></TD><TD></TD>
and replace the "6" with one MORE than the previous number.
- Select it all and paste back into the embedded XSL part
- Click Save

Wayne Hall
SPSFAQ030151 - How can I copy the security settings of one folder tree to another? - 0 Comments - stephencummins - Sun, May 12th, 2002 - Customisation
If you decide to go down the script route you will find this example from http://www.sharepointcode.com useful, it includes a procedure to copy permissions between folders

http://www.greenfel.demon.co.uk/scode/FolderPermissions.vbs

Alternatively it might be worth considering this third party product called DocKIT, it imports files from a file system but set the SharePoint permissions as it does so. You might be able to reverse out your current folders to a file folder and then create the copies then import back to SharePoint.

http://www.vyapin.com/products/enterprisenetworktools/dockit.htm

Steven Collier
SPSFAQ030150 - Can anyone please tell me how to use iframe to embed an ASP page in a web part? Kwong Yau Leung - 0 Comments - stephencummins - Sun, May 12th, 2002 - Customisation
Do this:

- create a new webpart
- choose type as html
- paste in code below
- change to correct src (ie change http://mypath)

Leung


<iframe frameborder="0" id="WebPartWPQ4" name="WebPartWPQ4" style=" width:100%;" src="http://mypath">

Your browser does not support IFrames.</iframe>

Nikander Bruggeman
Margriet Bruggeman

Here is another way.

Create a new web part, set the type to HTML, set the 'Get content from the following link' option, put the address of your .asp in the box, tick the option to 'Isolate this Web Part's content from the other Web Parts'. Sharepoint will create the iframe for you when it renders the page.

It is good practice to also put some HTML into the Embedded Content, if your .asp is unavailable sharepoint will display the Embedded Content instead, handy for error messages.

The name and ID of the iFrame are Webpart_WPQ_ so you would need to use DDSC to locate the frame.

Steven Collier
SPSFAQ030149 - How can I disable subscriptions using a VB script? - 0 Comments - stephencummins - Sun, May 5th, 2002 - Customisation
Set Rec = CreateObject("ADODB.Record")
Set Conn = CreateObject("ADODB.Connection")
Conn.Provider = "ExOLEDB.DataSource"

Conn.Open "http://myservername/SharePoint Portal Server/workspaces/"
Rec.Open "http://myservername/SharePoint Portal Server/workspaces/", Conn, 3
Set Flds = Rec.Fields

Flds("urn:schemas-microsoft-com:publishing:DisableSubscriptionNotifications")= True
Flds.Update


You need to bind to the workspaces folder which contains a property called DisableSubscriptionNotifications. If this
property is set to true then subscription notification is disabled. You can set this property to false again by
setting this property to false, like this:

Flds("urn:schemas-microsoft-com:publishing:DisableSubscriptionNotifications")= False

You can save the script in a file with vbs as extension for example disable.vbs and run this from the commandline using cscript disable.vbs or you can place the code in a vbscript web part.

Nikander Bruggeman
Margriet Bruggeman

*** OPTION B! ****

Nikander and Margriet also sent me this code to achieve the same objective:

Function ConfigSubscriptions(bState)
Dim InfoNT, Rec, Conn, Flds
Set InfoNT = CreateObject("WinNTSystemInfo")
Set Rec = CreateObject("ADODB.Record")
Set Conn = CreateObject("ADODB.Connection")
Conn.Provider = "ExOLEDB.DataSource"
on error resume next
Conn.Open "http://" & InfoNT.ComputerName & "/SharePoint Portal Server/workspaces/"
If Err <> 0 then
wscript.echo "Can't access the Web Storage System, ensure it is started. Exiting script."
wscript.quit(1)
End If
on error goto 0
Rec.Open "http://" & InfoNT.ComputerName & "/SharePoint Portal Server/workspaces/", Conn, 3
Set Flds = Rec.Fields
If bState = "" then 'retrieve current value
If Flds("urn:schemas-microsoft-com:publishing:DisableSubscriptionNotifications"
) = "" then
ConfigSubscriptions = "False"
Else
ConfigSubscriptions = Flds("urn:schemas-microsoft-com:publishing:DisableSubscriptionNotifications"
)
End If
Else ' set value
Flds("urn:schemas-microsoft-com:publishing:DisableSubscriptionNotifications"
)=bState
Flds.Update
ConfigSubScriptions=bState
End If
End Function

Page 17 of 24  -  Jump to: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24

Search options
Search for
   
In fields
   
In category
   
Dated in
   

links
subscribe
Get the latest posts via email:

quick search
Search via Google:

random books


Copyright © SPSFAQ.com, Stephen Cummins Limited, All Rights Reserved