Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Programatically Saving document information

  Asked By: Palash    Date: Sep 14    Category: Sharepoint    Views: 993

I am a Sharepoint newbee who has been given the task of
integrating Sharepoint with our existing software. I am having a problem
saving a document after changing any of it's properties. Here are the steps
I am taking:
1) Check out the document.
2) Check the document in.
3) Change on or more properties **ERROR (permission denied)**

I am able to perform all these steps via the dashboard so I'm fairly certain
my roles are set correctly.

Here is some sample code ( I hope this isn't too much info):

'** Open a document for editing.
Public Function GetDocument(ByVal HREF As String) As

Dim oDoc As PKMCDO.KnowledgeDocument
Dim oConn As adodb.Connection
Dim sHREF As String

On Error GoTo ErrHandler

Set oDoc = New PKMCDO.KnowledgeDocument
oDoc.PromptToAuthenticate = False

'Open the document.
Set oConn = New adodb.Connection
oConn.Open "URL=" & HREF
oDoc.DataSource.Open HREF, oConn, adModeReadWrite
Set oConn = Nothing

Set GetDocument = oDoc

Set oDoc = Nothing

Exit Function


Set oDoc = Nothing

If Not oConn Is Nothing Then
If oConn.State <> adStateClosed Then
End If
Set oConn = Nothing
End If

With Err
.Raise .Number, .Source, .Description, .HelpFile, .HelpContext
End With

End Function

'** Check a document in.
Public Sub CheckIn(ByVal PKMDocument As PKMCDO.KnowledgeDocument, _
ByVal Comments As String, _
ByVal FileName As String, _
Optional ByVal Publish As Boolean = True)

Dim oVer As PKMCDO.KnowledgeVersion
Dim oFSO As Scripting.FileSystemObject
Dim oShell As IWshRuntimeLibrary.WshShell
Dim oFolder As Scripting.Folder
Dim oStream As adodb.Stream

On Error GoTo ErrHandler

Set oFSO = New Scripting.FileSystemObject

'Copy the file to the document. (ignore this for now)
' If oFSO.FileExists(FileName) Then
' Set oStream = PKMDocument.OpenStream
' oStream.SetEOS
' oStream.Type = adTypeBinary
' oStream.LoadFromFile FileName
' oStream.Flush
' Set oStream = Nothing
' End If
' Set oFSO = Nothing

'* Test: Set a document property here.
PKMDocument.Title = "Checked In"
PKMDocument.DataSource.Save '<=== Error, "Permission Denied"

'Checkin the document.
Set oVer = New PKMCDO.KnowledgeVersion
If Len(Comments) = 0 Then
oVer.CheckIn Decode(PKMDocument.HREF)
oVer.CheckIn Decode(PKMDocument.HREF), , Comments
End If
If Publish Then
oVer.Publish Decode(PKMDocument.HREF)
End If

Set oVer = Nothing

Exit Sub


Set oFSO = Nothing
Set oShell = Nothing
Set oStream = Nothing
Set oVer = Nothing

With Err
.Raise .Number, .Source, .Description, .HelpFile, .HelpContext
End With

End Sub



4 Answers Found

Answer #1    Answered By: Jose Scott     Answered On: Sep 14

Double-check that you are a workspace coordinator (through the sharepoint
administration console).

If you are an administrator on the machine, but not a workspace coordinator,
you will see many coordinator options, but you are not allowed to save  them.
I've had the same thing happen when trying to import web parts.

Answer #2    Answered By: Taylor Clark     Answered On: Sep 14

I just double-checked... and I am listed as a coordinator.

Answer #3    Answered By: Anthony Rutledge     Answered On: Sep 14

Even I am also getting the same problem. When I want to save  a
document in document  library it gives permission  denied error, same
this works fine on other system which has SPPS.

Answer #4    Answered By: Heena Nagori     Answered On: Sep 14

I'm having this problem as well. Has anyone found out how to handle

Brief Synopsis:

Bind to document
Modify a document  property
Attmept to save  changes
Error - Permission Denied.

Didn't find what you were looking for? Find more on Programatically Saving document information Or get search suggestion and latest updates.