I am trying to populate a look-up column in a list, via the web service.
I am getting my data from an asp.net web form and using the web service method UpdateListItems and sending batch XML.
However, unless the user enters the exact data that the look up uses, the web service returns an error.
Is there anyway i can give the user of the web form, similar look-up functionality in order that the data passed will be identical?
i'm using share point 2007
The data source for the look-up column in share point is active directory.
_x0028_HR_x0029__x0020_Partner is the look up column, entering the users login name will look up their full name/ you can pick from a list.
Your help is much appreciated.
ClasService.Lists NewStarterList = new ClasService.Lists();
NewStarterList.Credentials = new System.Net.NetworkCredential(ConfigurationManager.AppSettings["SPUserName"].ToString(),
ConfigurationManager.AppSettings["SPPassword"].ToString(), ConfigurationManager.AppSettings["SPDomain"].ToString());
NewStarterList.Url = ConfigurationManager.AppSettings["SPUrl"].ToString() + ConfigurationManager.AppSettings["SPServicePath"].ToString();
try
{
string strBatch = "<Method ID='1' Cmd='Update'>" +
"<Field Name='ID'>" + clasStarter.ClasID + "</Field>" +
"<Field Name='Title'>" + clasStarter.Name + "</Field>" +
"<Field Name='_x0028_HR_x0029__x0020_Job_x0020'>" + clasStarter.JobTitle + "</Field>" +
"<Field Name='Entity'>" + clasStarter.Entity + "</Field>" +
"<Field Name='Practice_x0020_Groups'>" + clasStarter.PracticeGroup + "</Field>" +
"<Field Name='Dept'>" + clasStarter.Department + "</Field>" +
"<Field Name='Physical_x0020_Desk_x0020_Locati'>" + clasStarter.Location + ", " + clasStarter.LocationInBuilding + ", " + clasStarter.Department + "</Field>" +
"<Field Name='_x0028_HR_x0029__x0020_Line_x002'>" + clasStarter.LineManager + "</Field>" +
"<Field Name='_x0028_HR_x0029__x0020_Buddy'>" + clasStarter.Buddy + "</Field>" +
"<Field Name='_x0028_HR_x0029__x0020_Partner'>" + clasStarter.Partner + "</Field>" +//is a look up
"</Method>";
XmlDocument xmlDoc = new System.Xml.XmlDocument();
System.Xml.XmlElement elBatch = xmlDoc.CreateElement("Batch");
elBatch.SetAttribute("OnError", "Continue");
elBatch.SetAttribute("ListVersion", "1");
elBatch.SetAttribute("ViewName", ConfigurationManager.AppSettings["SPViewID"].ToString());
elBatch.InnerXml = strBatch;
XmlNode ndReturn = NewStarterList.UpdateListItems(ConfigurationManager.AppSettings["SPListID"].ToString(), elBatch);
}
catch (Exception exp)
{
throw new Exception("NewStarterForm - Clas Update failed ", exp);
}
I haven't figured out a full solution my problem, but i have figured out part of it.
Share point look-up columns have two parts, an id and a value. If you don't know the value then you can just use -1;# as a substitute for the ID
an example of this is
"<Field Name='Partner'>-1;#" + partnerLogOnId + "</Field>"
I will probably use a list, that allows users of my form to select people, and will pass the partnerLogOnId to my web service method.
Related
I am unable to create Text tabs on a dynamic envelop created without a template. I am sending the PDf document as bytes to Docusign since I need to generate a unique envelop id for each recipient. I am able to generate a recipients view with the document specified. I am also able to add signHereTabs and dateSignedTabs but not the text tabs/first name tabs. There are few places in the document where the user needs to fill in the information using text boxes. Please help with a solution to add a text tab for guided signing.
The envelop definition is as follows:
"<envelopeDefinition xmlns=\"http://www.docusign.com/restapi\">" +
"<emailSubjectxxx</emailSubject>" +
"<status>sent</status>" +
"<documents>" +
"<document>" +
"<documentId>1</documentId>" +
"<name>" + documentName + "</name>" +
"</document>" +
"</documents>" +
"<recipients>" +
"<signers>" +
"<signer>" +
"<recipientId>1</recipientId>" +
"<email>" + recipientEmail + "</email>" +
"<name>" + recipientName + "</name>" +
"<clientUserId>1</clientUserId>" +
"<tabs>" +
"<signHereTabs>" +
"<signHere>" +
"<anchorString>By:</anchorString>" +
"<anchorXOffset>1</anchorXOffset>" +
"<anchorYOffset>0</anchorYOffset>" +
"<anchorIgnoreIfNotPresent>false</anchorIgnoreIfNotPresent>" +
"<anchorUnits>inches</anchorUnits>" +
"<documentId>1</documentId>" +
"<pageNumber>1</pageNumber>" +
"<recipientId>1</recipientId>" +
"</signHere>" +
"</signHereTabs>" +
"<dateSignedTabs>" +
"<dateSigned>" +
"<anchorString>(Date)</anchorString>" +
"<anchorXOffset>1</anchorXOffset>" +
"<anchorYOffset>-0.25</anchorYOffset>" +
"<anchorIgnoreIfNotPresent>false</anchorIgnoreIfNotPresent>" +
"<anchorUnits>inches</anchorUnits>" +
"<documentId>1</documentId>" +
"<pageNumber>1</pageNumber>" +
"<recipientId>1</recipientId>" +
"</dateSigned>" +
"</dateSignedTabs>" +
"<textTabs>" +
"<textTab>" +
"<tabLabel>Data Field 1</tabLabel>" +
"<locked>false</locked>" +
"<xPosition>200</xPosition>" +
"<yPosition>200</yPosition>" +
"<documentId>1</documentId>" +
"<pageNumber>1</pageNumber>" +
"<recipientId>1</recipientId>" +
"<name>Text</name>" +
"<required>true</required>" +
"<value>Text</value>" +
"</textTab>" +
"</textTabs>" +
"</tabs>" +
"</signer>" +
"</signers>" +
"</recipients>" +
"</envelopeDefinition>";
Thanks!
You need to change the inner xml element name to just <text> for each data tab you want. So change to this:
"<textTabs>" +
"<text>" +
...
What code should i add in this in order to show a static text on document(like Amount charged, client name, company name etc) at some place that the user can't change at the time of signing the document and it should show up in the downloaded signed document from Docusign, i am using the request signature on document api walkthrough in this.
Thanks in advance.
string xmlBody =
"<envelopeDefinition xmlns=\"http://www.docusign.com/restapi\">" +
"<emailSubject>DocuSign API - Signature Request on Document</emailSubject>" +
"<status>sent</status>" + // "sent" to send immediately, "created" to save as draft in your account
// add document(s)
"<documents>" +
"<document>" +
"<documentId>1</documentId>" +
"<name>" + documentName + "</name>" +
"</document>" +
"</documents>" +
// add recipient(s)
"<recipients>" +
"<signers>" +
"<signer>" +
"<recipientId>1</recipientId>" +
"<email>" + recipientMail + "</email>" +
"<name>" + recipientName + "</name>" +
"<tabs>" +
//myTestCodeStart
"<tab>" +
"<DocumentID>1</DocumentID>" +
"<RecipientID>1</RecipientID>" +
"<PageNumber>1</PageNumber>" +
"<XPosition>100</XPosition>" +
"<YPosition>100</YPosition>" +
"<ScaleValue>1</ScaleValue>" +
"<Type>Custom</Type>" +
"<Name>TestName</Name>" +
"<TabLabel>LabelTest</TabLabel>" +
"<Value>TestValue</Value>" +
"<CustomTabType>Text</CustomTabType>" +
"<CustomTabWidth>42</CustomTabWidth>" +
"<CustomTabHeight>11</CustomTabHeight>" +
"<CustomTabRequired>true</CustomTabRequired>" +
"<CustomTabLocked>true</CustomTabLocked>" +
"<CustomTabDisableAutoSize>false</CustomTabDisableAutoSize>" +
"<CustomTabValidationPattern/>" +
"<CustomTabValidationMessage/>" +
"<RequireInitialOnSharedTabChange>false</RequireInitialOnSharedTabChange>" +
"<ConcealValueOnDocument>false</ConcealValueOnDocument>" +
"<Bold>false</Bold>" +
"<Italic>false</Italic>" +
"<Underline>false</Underline>" +
"</tab>" +
//myTestCodeEnd
"<signHereTabs>" +
"<signHere>" +
"<xPosition>350</xPosition>" + // default unit is pixels
"<yPosition>517</yPosition>" + // default unit is pixels
"<documentId>1</documentId>" +
"<pageNumber>1</pageNumber>" +
"</signHere>" +
"</signHereTabs>" +
"</tabs>" +
"</signer>" +
"</signers>" +
"</recipients>" +
"</envelopeDefinition>";
To make a tab value read-only in the Envelope, set the locked property to true for that tab.
<locked>true</locked>
For example, including this XML within a "Create Envelope" request would place the read-only text 123456 within the document (at the specified X/Y location):
<textTabs>
<textTab>
<tabLabel>AcctNumber</tabLabel>
<locked>false</locked>
<name>Account Number</name>
<value>123456</value>
<xPosition>100</xPosition>
<yPosition>200</yPosition>
<font>arial</font>
<fontSize>12</fontSize>
<documentId>1</documentId>
<pageNumber>1</pageNumber>
</textTab>
</textTabs>
(Your code shows you using <tab> -- which isn't a valid element name in the REST API. Seems like you should be using <textTabs> and <textTab> as I show in the exxample above.)
I would like to update a list item using SharePoint and am stuggling to find 1 decent CAML example.
Here is what I want to do, in SQL my query would look something like this
update [table] set field='value' where fieldID = id;
so this would mean I have 1 item in a list I would like to update 1 field on given the ID of that listitem.
I've tried this, but it doesn't work:
batchElement.InnerXml = "<Method ID='1' Cmd='Update'>" +
"<Field Name='DeliveryStatus'>" + newStatus.ToString() + "</Field>" +
"<Where><Eq><FieldRef Name='ID' /><Value Type='Text'>" + id + "</Value></Eq></Where></Method>";
I'll add this answer for the community, although it might not answer all your questions.
batchElement.InnerXml = "<Method ID='1' Cmd='Update'>" +
"<Field Name='ID'>" + id + "</Field>" +
"<Field Name='DeliveryStatus'>" + newStatus.ToString() + "</Field></Method>";
It seems the first field you specify is the where clause.
I have no idea how you would do any advanced filtering with this (nots or exclusions or in clauses or ranges). But hope this basic info helps.
You don't need use the where clause to update a list item.
atchElement.InnerXml = "<Method ID='1' Cmd='Update'>" +
"<Field Name='DeliveryStatus'>" + newStatus.ToString() + "</Field>" +
"<FieldRef Name='ID' /><Value Type='Text'>" + id + "</Value></Method>";
The only think you need do is to provide the ID like above.
I am inserting a list item using sharepoint web services....
Here is my code:
item += #"<Field Name=""HyperLinkField"">" + this.SharePointSiteAddressLinks + #"/lists/" + this.ListName + #"/" + this.ID + "_" + this.MessageID + ", " + this.MessageID + ".ext</Field>";
the value of SharePointSiteAddressLinks is http://machineName
The list item gets inserted into the list, but the value of the hyperlink is set to http://localhost
Firstly - why does SharePoint take it apon itself to (incorrect) my links, 2ndly what can I do to turn it off?
Thank you
Restarted the server, everything worked fine....
Pagination (Next button) doesn't work for custom BusinessDataListWebPart.
I am adding BusinessDataListWebPart using code. Everything works fine. I can see 20 data raw at the same time but when I click "Next Button", I can not see next 20-40 data. A postback occurs, but the pageindex never changes.
I am using following code to add BusinessDataListWebPart to the Sharepoint site.
BusinessDataListWebPart consumer = new BusinessDataListWebPart();
consumer.Title = title;
consumer.Application = instance.Name;
consumer.Entity = projEntity.Name;
consumer.XslLink = "/Style%20Library/XSL%20Style%20Sheets/" + xslFileName;
consumer.PageSize = 20;
OK..I found the answer.
For pagination I needed to add "ParameterBindings" to the business data list webpart.
My final code is, It works perfect.
BusinessDataListWebPart consumer = new BusinessDataListWebPart();
ServerContext serverContext = ServerContext.GetContext(site);
SqlSessionProvider.Instance().SetSharedResourceProviderToUse(serverContext);
LobSystemInstance instance = ApplicationRegistry.GetLobSystemInstanceByName(applicationName);
Entity projEntity = instance.GetEntities()[entityName];
consumer.Title = title;
consumer.Application = instance.Name;
consumer.Entity = projEntity.Name;
consumer.XslLink = "/Style%20Library/XSL%20Style%20Sheets/" + xslFileName;
consumer.PageSize = 20;
consumer.ParameterBindings = "<ParameterBinding Name=" + "\"dvt_firstrow\"" + " Location=" + "\"Postback;Connection\"" + "/>" +
" <ParameterBinding Name=" + "\"dvt_sortdir\"" + " Location=" + "\"Postback;Connection\"" + "/>" +
" <ParameterBinding Name=" + "\"dvt_sortfield\"" + " Location=" + "\"Postback;Connection\"" + "/>" +
" <ParameterBinding Name=" + "\"dvt_filterfields\"" + " Location=" + "\"Postback;Connection\"" + "/>" +
" <ParameterBinding Name=" + "\"dvt_partguid\"" + " Location=" + "\"Postback;Connection\"" + "/>";