I am trying to pre-populate my SharePoint list using its List Instance in SharePoint hosted app with default data. And it seems to work for the below code.
<ListInstance ...>
<Data>
<Rows>
<Row>
<Field Name="URL">http://google.com, Project Link</Field>
</Row>
</Rows>
</Data>
But when i try to add the URL from list in my app it is not working.
<ListInstance ...>
<Data>
<Rows>
<Row>
<Field Name="URL">~appWebUrl/Lists/SiteImages/image.png, Project Link</Field>
</Row>
</Rows>
</Data>
What is the syntax for this?
I don't believe it is possible to use tokens like ~appWebUrl in xml list instance definition. I suggest just to put relative url, e.g.
<Field Name="URL">/Lists/SiteImages/image.png, Project Link</Field>
To set url field of the current web you can use the ~site. If you want it to be that of the parent site collection then use ~sitecollection
Modify your code as below:
<Field Name="URL">~site/Lists/SiteImages/image.png, Project Link</Field>
If the url is there in the parent site collection, use it as below:
<Field Name="URL">~sitecollection/Lists/SiteImages/image.png, Project Link</Field>
Reference - URL and tokens in SharePoint
Related
I need to limit user access only to partners added himself.
That's what I have made:
security.xml of my module:
<odoo>
<data noupdate="1">
<record model="ir.rule" id="partner_access_user_rule">
<field name="name">Parners only for editors</field>
<field name="model_id" ref="base.model_res_partner"/>
<field name="domain_force"> [('create_uid','=',user.id)] </field>
<field name="groups" eval="[(4,ref('base.group_user'))]"/>
</record>
</data>
</odoo>
Update I have changed ref="base.model_res_partner" as Lucas told, and my module have installed, but the rule didn't uppear in settings > security>"record rules" and didn't apply. I've added record rule via web interface and it works. How I to export it to apply to my module? The record rule settings I've added to question.
Export file:
id,"perm_create","perm_unlink","perm_read","perm_write","domain_force","groups/id","name","model_id/id"
__export__.ir_rule_97,"True","True","True","True","[('create_uid','=',user.id)]","base.group_user","Partners only for editors","account.model_res_partner"
Your code is looking for the model res.partner on mail.partner.access, when it should look on base.
Try the following:
<field name="model_id" ref="base.model_res_partner"/>
If your row-level access rule doesn't work, create and test it using Odoo interface, export it to csv and change your original XML. Or create xml directly from CSV (look at attached picture). In my case I've found mistake: model_id should refer to base.model_res_partner
I created a SharePoint hosted app and a new list. But I want to show its list column display name by a resources file. For that I created a new resource
from rigth click Feature > Add Feature Resource then the created key is PersonName and the value Person Name.
After I wrote in the list schema.xml
<Field ID="{27912FBB-5063-4FF7-9829-B194DDBC7FEB}" Type="Text" Name="PersonName" DisplayName="$Resources:PersonName" Required="TRUE" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="PersonName" MaxLength="255" />
But the list columns seems to be
$Resources:_FeatureId{54A6CD41-6DB3-45FF-9A2F-D496A13A871F},PersonName;
How can I fix that?
I am sure pretty late, but I just had the same problem and I figured it out.
What you are probably doing is try to use the resource key inside of the schema.xml of the list.
That is the wrong place to use it. Instead copy the whole line:
<Field ID="{27912FBB-5063-4FF7-9829-B194DDBC7FEB}" Type="Text" Name="PersonName" DisplayName="$Resources:PersonName" Required="TRUE" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="PersonName" MaxLength="255" />
Inside of the elements.xml of the list where the list definition is. So it should for your example look like this:
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<ListTemplate
Name="UserList"
Type="100"
BaseType="0"
OnQuickLaunch="TRUE"
SecurityBits="11"
Sequence="410"
DisplayName="UserList"
Description="My List Definition"
Image="/_layouts/15/images/itgen.png"/>
<Field ID="{27912FBB-5063-4FF7-9829-B194DDBC7FEB}" Type="Text"
Name="PersonName" DisplayName="$Resources:PersonName"
Required="TRUE" SourceID="http://schemas.microsoft.com/sharepoint/v3"
StaticName="PersonName" MaxLength="255" />
</Elements>
If you read carefully this is also documented in the msdn:
https://msdn.microsoft.com/en-us/library/office/fp179919.aspx#LocalizingAppWeb
search for the title "To localize the column names of a custom list" and you should find it.
To add a list item in SharePoint 2007/2010 I currently use the following XML:
<Batch OnError='Continue' ListVersion="1">
<Method ID="1" Cmd="New">
<Field Name="ID">New</Field>
<Field Name="Title">anyTitle</Field>
<Field Name="Account_x0020_Name">SomeText</Field>
</Method>
</Batch>
Sometimes the internal name is not equal to the display name. For example here the DisplayName is "Account Name" but its internal name is "Account_x0020_Name".
Is there any way to create a new list item using the DisplayName instead of the internal name?
I've already tried using <Field DisplayName="Account Name">SomeText</Field> but that gives a SoapException.
Any Ideas?
You need to use the Internal Field Name. The easiest way to get it is via list/library settings, selecting the field and looking for the name in the URL.
How do i represent an image through CAML? I have a list and im trying to create a list instance by adding data through CAML
<Data>
<Rows>
<Row>
<Field Name="Title">Promotion 2</Field>
<Field Name="Promotion Image">/SiteCollectionImages/PR.gif</Field>
</Row>
</Rows>
</Data>
Have you tried:
<Field Name="Promotion Image"><![CDATA[[<IMG SRC="/SiteCollectionImages/PR.gif"/>]]></Field>
this did the trick:
<Field Name="Promotion Image"><![CDATA[<IMG SRC="/SiteCollectionImages/PR.gif"></IMG>]]></Field>
thanks Magnus
There was a similar question posted regarding the same topic, but I'm adding to the question and the previous discussion was resolved.
Here is the link to the original question: Auto number column in SharePoint list
I'm now trying to find out if in a Custom List in MOSS SharePoint 2007 there is a column called "ID(link to item)".
I know that when creating an Issues List in SharePoint, there exists an "Issue ID (link to item)" field that is by by default included in the view, however, I cannot find out if a similar field exists for a Custom List.
The answer is No... but you can create one.
Cracking open a website using SharePoint Manager (which rocks) you can see the definition of the "IssueID" column and the one that is used to display the "ID(link to item)"
I include the schema xml from my site below
<?xml version="1.0" encoding="utf-16"?>
<Field ID="{de57307b-e69a-4cf9-b3a9-b6a728ecf773}" Sealed="TRUE" ReadOnly="TRUE" Name="IssueID" Type="Computed" DisplayName="Issue ID" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="IssueID" FromBaseType="TRUE">
<FieldRefs>
<FieldRef Name="ID" />
</FieldRefs>
<DisplayPattern>
<Column Name="ID" />
</DisplayPattern>
</Field>
<?xml version="1.0" encoding="utf-16"?>
<Field ID="{03f89857-27c9-4b58-aaab-620647deda9b}" ReadOnly="TRUE" Type="Computed" Name="LinkIssueIDNoMenu" DisplayName="Issue ID" Dir="" DisplayNameSrcField="IssueID" AuthoringInfo="(linked to item)" SourceID="http://schemas.microsoft.com/sharepoint/v3" StaticName="LinkIssueIDNoMenu">
<FieldRefs>
<FieldRef Name="ID" />
</FieldRefs>
<DisplayPattern>
<HTML><![CDATA[<a href="]]></HTML>
<URL />
<HTML><![CDATA[" ONCLICK="GoToLink(this);return false;" target="_self">]]></HTML>
<Column HTMLEncode="TRUE" Name="ID" />
<HTML><![CDATA[</a>]]></HTML>
</DisplayPattern>
</Field>
Change the GUIDs and you can add these columns to a custom list, they will display in the manner you require. I would recommend creating a feature for the columns (maybe use STSDev) and releasing via a solution to any thing other than a dev site.
You could use SharePoint Designer to convert your list view into a Data View WebPart. From there you have complete control over the XSL used for the view rendering which would make it trivial for you to link to the item from any or all fields.
There is a powershell script available which you can use to add context menu for a field.
ADD THE SHAREPOINT LIST ITEM'S CONTEXT MENU TO ANY COLUMN WITH POWERSHELL
PS> & .\AddMenuColumn.ps1 -webUrl http://[server:port]/site/subsite/ -listName "Test" -fieldTitle "justAnyColumn" -addToDefaultView $true