使用标准的WebServices是不可能的,但是您可以用这样的方法编写自己的WS:
[WebMethod]
public void FixFileData(string fileUrl, DateTime created, DateTime modified, string author, string editor)
{
Guid siteId = SPContext.Current.Site.ID;
Guid webId = SPContext.Current.Web.ID;
try
{
SPSecurity.RunWithElevatedPrivileges(delegate
{
using (SPSite site = new SPSite(siteId))
{
using (SPWeb web = site.OpenWeb(webId))
{
SPFile file = web.GetFile(fileUrl);
SPListItem fileItem = file.Item;
fileItem[SPBuiltInFieldId.Created] = SPUtility.CreateISO8601DateTimeFromSystemDateTime(created.ToUniversalTime());
fileItem[SPBuiltInFieldId.Modified] = SPUtility.CreateISO8601DateTimeFromSystemDateTime(modified.ToUniversalTime());
try
{
fileItem[SPBuiltInFieldId.Author]=web.EnsureUser(author);
}
catch (Exception)
{
// Your loggin code
}
try
{
fileItem[SPBuiltInFieldId.Editor] = web.EnsureUser(editor);
}
catch (Exception)
{
// Your loggin code
}
fileItem.UpdateOverwriteVersion();
if (fileItem.ParentList.EnableMinorVersions)
{
file.Publish("SPFileUpload");
}
if (fileItem.ModerationInformation != null)
{
file.Approve("SPFileUpload");
}
}
}
});
}
catch (Exception)
{
// Your loggin code
}
}