Logo 
Search:

Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Not able to append the HTML file in sharepoint

  Asked By: Ali    Date: Dec 03    Category: Sharepoint    Views: 943

I need a solution for a query which is briefed below.


1) User1 will creates a file through ASP/VBScript Code and check in.
2) User2 has to open the same file which was created by User1 and appened
data to the file.

The problems i face with the above query was.

1) User1 can create the file properly and with the File1.htm,Ver(0.1)
2 ) But the problem here is the user2 is not able to checkin or checkout
the File1.htm to append the data.

Share: 

 

2 Answers Found

 
Answer #1    Answered By: Alicia Scott     Answered On: Dec 03

Can you check  the access rights of user2. He must have Author or Coordinator
rights so that he can append  and check in the file.

 
Answer #2    Answered By: Mike Lamb     Answered On: Dec 03

i checked it and it was coordinator right, but still i face the probs, i
will paste the code  below can u please go through..

Function Read_HistoricalComments()
On error resume next
Dim oDoc ' As PKMCDO.KnowledgeDocument
Dim oStream ' As ADODB.Stream
Set oDoc = CreateObject("CDO.KnowledgeDocument")
Set oStream = CreateObject("ADODB.Stream")

oDoc.DataSource.Open Request.Form("TaskHrefHis")

If err.number = -2147217895 Then
strText = ""
Read_HistoricalComments = ""
Set oDoc = Nothing
else
Set oStream = oDoc.OpenStream
oStream.Type = 2
If Not oStream.EOS = True Then
strText = oStream.ReadText
End If
strText = Replace(strText, "</table></body></html>", "")
Read_HistoricalComments = strText
Set oStream = Nothing
Set oDoc = Nothing
end if
End Function

Between this two function some text will be appened to the string
variable strText

Function Write_HistoricalComments(strToBeAppend)
Dim oDoc 'Holds the CDO.KnowledgeDocument Object
Dim oStream 'Holds the ADODB.Stream Object

Set oDoc = CreateObject("CDO.KnowledgeDocument")

Set oVersion = CreateObject("CDO.KnowledgeVersion")
Set oStream = CreateObject("ADODB.Stream")

oDoc.DataSource.Open Request.Form("TaskHrefHis")
If err.number = -2147217895 Then
bNotExists = True
else
oDoc.Delete
set oDoc = Nothing
Set oDoc = CreateObject("CDO.KnowledgeDocument")
end if

strToBeAppend = strToBeAppend & "</table></body></html>"

Set oDoc = CreateObject("CDO.KnowledgeDocument")

Set oStream = oDoc.OpenStream
oStream.Type = 2 ' 1 = adTypeBinary , 2 =
adTypeText
oStream.SetEOS
oStream.WriteText strToBeAppend
oStream.Flush

oDoc.Title="HistoricalComments"

oDoc.DataSource.SaveTo Request.Form("TaskHrefHis"),,, &H4000000
oVersion.Checkin oDoc
oVersion.publish oDoc

Set oStream = Nothing
Set oDoc = Nothing
End Function

 
Didn't find what you were looking for? Find more on Not able to append the HTML file in sharepoint Or get search suggestion and latest updates.




Tagged: