SharePointList问题请帮帮我! [英] SharePointList Problem Please Help Me!
本文介绍了SharePointList问题请帮帮我!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
public void Button1_Click(对象发件人,EventArgs e)
{
SPWeb mySite = SPContext.Current.Web;
SPListItemCollection listItems = mySite.Lists [ doneee]。
SPListItem item = listItems.Add();
item.Update();
}
void documentAttachmentInSPList(SPListItem item)
{
SPListItem spListItem = item;
string LISTNAME = spListItem.ParentList.Title;
if (!string.IsNullOrEmpty(fileupload.FileName))
{
string fileExtension = fileupload.FileName.Substring(fileupload.FileName.IndexOf( *) );
for ( int i = 0 ; i < spListItem.Attachments.Count; i ++)
{
if ((spListItem.Attachments [i]!= null )
&&(spListItem.Attachments [i] .Equals( FILENAME + fileExtension)))
{
spListItem.Attachments.Delete( FILENAME + fileExtension);
break ;
}
}
spListItem.Attachments.Add( FILENAME + fileExtension,fileupload.FileBytes);
string attachmentURL = Request.Url.Scheme + :// + Request.Url.Authority
+ / Lists / + LISTNAME + / Attachments / + spListItem.ID + /;
spListItem [ 附加文件] = attachmentURL + FILENAME + fileExtension + ,查看文件;
}
我创造了一个按钮和fileupload控件,以便当我浏览文件并单击按钮文件时应该转到自定义列表。使用上面的代码我无法上传文件。
解决方案
< blockquote>那你保存你的物品吗? (spListItem.SystemUpdate(false))
#JK
public void Button1_Click(object sender, EventArgs e)
{
SPWeb mySite = SPContext.Current.Web;
SPListItemCollection listItems = mySite.Lists["doneee"].Items;
SPListItem item = listItems.Add();
item.Update();
}
void documentAttachmentInSPList(SPListItem item)
{
SPListItem spListItem = item;
string LISTNAME = spListItem.ParentList.Title;
if (!string.IsNullOrEmpty(fileupload.FileName))
{
string fileExtension = fileupload.FileName.Substring(fileupload.FileName.IndexOf("*"));
for (int i = 0; i < spListItem.Attachments.Count; i++)
{
if ((spListItem.Attachments[i] != null)
&& (spListItem.Attachments[i].Equals("FILENAME" + fileExtension)))
{
spListItem.Attachments.Delete("FILENAME" + fileExtension);
break;
}
}
spListItem.Attachments.Add("FILENAME" + fileExtension, fileupload.FileBytes);
string attachmentURL = Request.Url.Scheme + "://" + Request.Url.Authority
+ "/Lists/" + LISTNAME + "/Attachments/" + spListItem.ID + "/";
spListItem["Attached File"] = attachmentURL + "FILENAME" + fileExtension + ", View FILE";
}
I created a button and fileupload control so that when i browse the file and click on button file should go intot the customlist.By using above code i am not able to upload file.
解决方案
And do you save your item then? (spListItem.SystemUpdate(false))
#JK
这篇关于SharePointList问题请帮帮我!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文