When I call the SharePoint GetListItems web method, it returns some of the items with a GUID as the key, and the rest with a text ID as the key.
For example, if I have a form library with three columns, say UserName, EnvironmentName, and LastStatus, they might be returned as follows:
ows_b5acede2_x002d_ab94_x002d_470f_x002d_b9e9_x002d_cdf4d3fe4e01=\"John Doe\" ows_EnvironmentName=\"Windows\"
ows__x0032_ef676c4_x002d_8f1c_x002d_4287_x002d_97c2_x002d_0d05ef782b83=\"Submitted\"
Why is it returning the column key as a GUID in some cases and how can I force it to return the text ID? Thanks.
It could be that the InternalName of these columns is set to the Guid.
You can use SharePoint Manager on the server to look at how everything is set up (there is both 2007 and 2010 versions)
Related
With JIRA JAVA API (jira-rest-java-client-core), I'm trying to set custom field value. During creation of issue I can set custom field
Field myField = ...
new IssueInputBuilder().setFieldValue(myField.getId(), <value ??>)
But I don't know what should be the value. I mean I don't know how I can obtain list of available values. If I go to the web page I see list of values: Val1, Val2 etc. But how I can obtain them via API?
Thanks
Bartek
I'm new to Umbraco, so this may not even be feasible. I've created my own Datatype using Archetype and want to be able to get an instance of that type on the page by type, not alias.
I know that I can do the following:
model.Content.GetPropertyValue("myAlias")
But I want to know if it's feasible to get the property by the type. Something along the lines of:
model.Content.GetPropertiesByType("TypeName")
which would return a list of controls on the page of that type?
Is this feasible?
It's possible, but not exactly straight forward.
Take a look at the available Umbraco Data Services - you'll need to retrieve the DataTypeDefinitions from the DataTypeService and retrieve the ContentType for the Model's IPublishedContent using the ContentTypeService.
Once you have these, you can match up the PropertyTypes on the ContentType with the retrieved DataTypeDefionitions based on the PropertyType's DataTypeDefinitionId.
The PropertyTypes have an Alias property which will match up with the Property Aliases on the Content itself.
You can use the content service if you get the id of the datatype you trying to find the multiples of from the url when you edit/create the datatype.
#foreach (var p in ApplicationContext.Current.Services.ContentService.GetById(Model.Content.Id).PropertyTypes.Where(p => p.DataTypeDefinitionId == -89))
{
<p>#p.DataTypeDefinitionId</p>
}
We've a requirement to pass a custom query variable to filter the TFS records by running saved TFS query.
As we have #Me, #Project, #Today and [Any] can we use a custom variable like below, if yes how can we do this or is there any better approach for this.
UserEmailAddress = #EmailAddress, to get the records which matches the #EmailAddress which is passed from C# source code and we will add the variable and call the saved TFS query.
var variables = new Dictionary<string, string>() { { "project", "ESE_Proj" }, {"EmailAddress", "test} };
wiQuery = new Query(wiStore(), query.QueryText, variables);
wiTrees = wiQuery.RunLinkQuery();
Field name of a Work Item Type, we have created work item types, say example Person is a work item type with UserEmailAddress as field in it. I want to create a query in tfs such that user can call query from c# by passing email address by taking it from text box and run the query for the entered email address –
You will not be able to store the query in TFS. While you can create and use custom variables in c# with the API TFS has no understanding of them.
You can only use #me, #project, #today, and #currentiteration in a stored query.
Ok, got it. Because the query is also used by the rest of the team in the team explorer. I left the #project in there, but when I need it, I replace #project with the actual project name.
OK so I've created a new table within the existing aspnetdb.mdf database aspnet_Groups, and added and related a foreign key to the aspnet_Users table GroupId.
So users table now goes:
ApplicationId
UserId
UserName
LoweredUserName
MobileAlias
IsAnonymous
LastActivityDate
GroupId //<--- Added by me, and related to aspnet_Groups table
Groups table only has GroupId and GroupName so it's pretty simple actually.
What I wanna know, is how do I save and get data for this field/table from within MVC application. Or does this have to be done another way?
Edited
I would not recommend intervining into aspnetdb working ...
If you need to - create your own table and link it to aspnetdb.
More control, more customization, less bugs introduced to internal MS authentication...
Great posting about this Storing data in a Custom table within ASPNETDB.mdf vs. storing information about a user in a profile
But again, there's no right answer to your question - as long as it works and having good usability and readability - its fine.
If you can use Roles as your groups - this can do the trick, but if not, I'd define additional table, rather than intervining into prebuilt one. This is my opinion.
Edit 2
There are many ways you can work with aspnetdb. You can even embed it into your own database. Like this: Configuring ASP.NET 2.0 Application Services to use SQL Server 2000 or SQL Server 2005
Answering your particular question: you can access aspentdb via authentication API:
string userName = Membership.GetUserNameByEmail(emailToCheck);
if (userName != null)
or override membershipprovider, roleprovider and securityprovider or even access directly like described here
Membership, Role, and Security
Hope this helps!
I'm using NerdDinner as a guide for my first MVC/LINQ to SQL project. It discusses the use of the ViewModel pattern when a View needs data from multiple sources - in their example: Dinners and Countries (serves as the drop down list).
In my application, the problem is a bit different. It's not so much different data, rather data linked via a key constraint. I have a Story table that links to aspnet_users via the UserId key. I would like to have easy access to the UserName for each story.
Since I'm using the repository pattern and returning IQueryable in some cases for deferred execution, I'm struggling with the correct way to shape the data. So I'm using this VideModel pattern right now to make it work but not sure if it's the right way.
Instead of returing IQueryable Story (which wouldn't work since I need the UserName), I'm returning a new custom class UserStory, which has a Story property and a string Username property.
What are your thoughts?
It seems like your question has less to do with MVC as it is simply a question about how to access the story data based on the username string.
Would it be possible to create a view in your database with all the UserStory data, the username, along with userid in it? That way, you could select from the view based on the username you have.
To create the view, you would simply have to do a join between the user table and the userstory table based on the userid.
After that, you could still use the repository pattern with the IQueryable being returned.
If you are wanting to do updates, it would be simple to do since you still have the userid, and would be able to link back to the actual table which would need the update.
If you look at Kigg, you will see that they mess about with the initial model to create custom ViewModels. That's the thing that NerdDinner doesn't cover in any detail. You could create a StoriesWithUserName class that inherits from Stories, but adds a new property - UserName. Then you return that to your View which would inherit from IEnumerable<StoriesWithUserName>
[EDIT]
Oops. Didn't spot that you already did this :o)
Using the repository pattern and returning an IQueryable of Stories is fine. The relationship allows you to access the the username value something like this >>
Assuming you are returning the IQueryable in your model object:
foreach(Story story in Model.Stories)
{
// do something with the value
response.write(story.aspnet_user.UserName);
};
Your Repository method would look like this:
public List<Stories> GetStories(Guid UserId)
{
return datacontext.Stories.Where(u => u.UserId = UserId).ToList();
}
The relationship will automatically provide you with access to the UserName value in the foreach loop i first mentioned. nothing more is required.
I'm not sure why your pagination control failed on Count() though??
Hope this helps