2011-07-13 10 views

答えて

0
For getting the list item field information 
    public void LoadPropertyInfo() 
    { 
    using (context = new ClientContext(siteCollectionUrl)) 
    { 
    spWeb = context.Web; 
    propertiesList = spWeb.Lists.GetByTitle(listName); 
    FieldCollection fields = propertiesList.Fields; 
    context.Load(fields); 
    SP.CamlQuery query = new SP.CamlQuery(); 
    query.ViewXml = string.Format("<View><Query><Where><Eq><FieldRef Name=\"{0}\" /><Value Type=\"Text\">{1}</Value></Eq></Where></Query></View>", propertyID, PropertyIDValue); 
    listItems = propertiesList.GetItems(query); 
    context.Load(listItems); 
    context.ExecuteQueryAsync(GetRequestSucceeded, RequestFailed); 
    } 
    } 

    Pass the item id here for getting the attachments 

    private void GetAttchmentCollection(string id) 
    { 
    string RedirectHost = string.Empty; 
    string Host = string.Empty; 
    context = SP.ClientContext.Current; 
    RedirectHost = serviceUrl + "_vti_bin/Lists.asmx"; 
    BasicHttpBinding binding = new BasicHttpBinding(); 
    if (System.Windows.Browser.HtmlPage.Document.DocumentUri.Scheme.StartsWith("https")) 
    { 
    binding.Security.Mode = BasicHttpSecurityMode.Transport; 
    } 
    binding.MaxReceivedMessageSize = int.MaxValue; 
    EndpointAddress endpoint = new EndpointAddress(RedirectHost); 
    ServiceReference1.ListsSoapClient oClient = new ServiceReference1.ListsSoapClient(binding, endpoint); 
    oClient.GetAttachmentCollectionCompleted += new EventHandler<ServiceReference1.GetAttachmentCollectionCompletedEventArgs>(oClient_GetAttachmentCollectionCompleted); 
    oClient.GetAttachmentCollectionAsync(listName,id); 
    } 

Your can try this link too. 

http://helpmetocode.blogspot.com/2011/11/managed-client-object-models-in.html 
関連する問題